Home > Software design >  How to send multiple query variables using GraphQL Playground
How to send multiple query variables using GraphQL Playground

Time:11-17

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.

CodePudding user response:

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

  • Related