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. In particular, the serialization format must support representations of the following four primitives:
- Map
- List
- String
- Null
Serialization formats which can represent an ordered map should preserve the order of requested fields as defined byCollectFields()in the Execution section. Serialization formats which can only represent unordered maps should retain this order grammatically (such as JSON).
Producing a response where fields are represented in the same order in which they appear in the request improves human readability during debugging and enables more efficient parsing of responses if the order of properties can be anticipated.
A serialization format may support the following primitives, however, strings may be used as a substitute for those primitives.
- Boolean
- Int
- Float
- Enum Value