This isn't even close to valid json:
{
empireHero: hero(episode: EMPIRE) {
name
}
jediHero: hero(episode: JEDI) {
name
}
} type Starship {
id: ID!
name: String!
}
type CaptainQuery {
captains(starshipFilter: [Starship!]): [Starship]
}
# leading to
{
captains(starshipFilter: [{name: "Alpha"},{id: "cafebabe"}]) { id }
}
which I recognize is most often fixed via variables but when the hello-world examples call it out, something has gone awry https://docs.github.com/en/graphql/guides/forming-calls-with...And even the embedded part isn't valid json without quoting the keys.
Of course the query itself is not json, why should it be? It describes the shape of a json object, and queries are generally pretty static. But the request to the server is json, the request variables are json, the result is json, and all the json tooling can be used in the responses in our clients.
Honestly, one of the reasons I like GraphQL is the fact that underlying it all is just JSON.
writing queries is stupid easy if you use a tool like GraphIQL especially with the explorer.