Advertisement
Guide
About the GraphQL Formatter & JSON to Schema
GraphQL queries are often copied from logs, network tabs or code where they have been squeezed onto one line. This formatter puts each field on its own line with consistent indentation, so the shape of the query — which mirrors the shape of the response — is easy to read. It works on schema definitions too.
The JSON → schema tab goes the other way: paste a sample response and get type definitions to start a schema or a mock server from.
How types are inferred from JSON
- Whole numbers become
Int, decimalsFloat, true/falseBoolean, textString. - Fields named
idor ending inIdbecomeID. - Nested objects become their own type, named after the key; array items are merged, so a field missing from some items is nullable.
- A field that is
nullin the sample cannot be typed and becomes a nullable String — change it by hand.
How to use it
- 1Paste a query, mutation, fragment or schema.
- 2Choose indentation, or tick Minify for a single line.
- 3Copy or download the result.
- 4To build types instead, switch to JSON → GraphQL schema and paste a sample response.
Frequently asked questions
Does formatting change what the query does?
No. Only whitespace and commas, which GraphQL ignores, are changed. Field order, arguments and comments are kept.
Why are commas removed?
Commas are optional in GraphQL. The formatter puts them between arguments for readability, and the minifier drops them because a space does the same job.
Does it validate my query against a schema?
No. It checks the syntax as it tokenizes but does not know your schema, so unknown fields are not reported.
Is my query sent anywhere?
No. Formatting and schema inference run entirely in your browser.
