Hacker News new | ask | show | jobs
by geonnave 3248 days ago
Maybe they want to be, to some extent, serialization-format independent?
1 comments

That's correct. See https://facebook.github.io/graphql/#sec-Serialization-Format.

> GraphQL does not require a specific serialization format. However, clients should use a serialization format that supports the major primitives in the GraphQL response.

JSON is preferred, but not required.

The section of the document you refer to is regarding the response, not the query-language itself. From the document: "A GraphQL document is defined as a syntactic grammar" -- therefore GraphGL has a (one) preferred syntactic embodiment. The document goes on (in A BNF style) to define the syntax of the language. The language defined here is very close, but not quite, JSON - if it were JSON, they could have defined the semantics of GraphQL based on its structure (which could be surfaced also in XML, etc.) rather than defining any surface/syntactic form at all. If this domain specific language had a huge value-add over plain JSON, it would be another matter, but the notational convenience is small given the all the tooling that you lose by not having be in a standard format.