1

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.

2
  • You can't have that trailing comma in JSON (next to last line) Commented Nov 16, 2022 at 23:14
  • Thanks, but it makes no difference. Going to edit that out. Commented Nov 16, 2022 at 23:21

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.