jsongraphqlgraphql-playground

How to send multiple query variables using GraphQL Playground


If I have one variable named $external and one named $manifest, which should be JSON, how do I define them both as query variables in the GraphQL Playground?

{
  "external": "name",
  "manifest": 
    {
    "some": "json",
    }
}

This gives me an error: Expected String but found }``.

Yes, I am on the query variables tab, something that has caught out many people asking about how to pass a single query variable.


Solution

  • Avoid trailing commas in JSON (line 5 and originally line 6 as well)

    {
        "external": "name",
        "manifest": {
            "some": "json"
        }
    }
    

    is valid JSON

    You can test your JSON using jsonlint