Mock JSON · Response data · JSON Schema — 3 modes

Convert GraphQL to JSON
Mock data, response
or JSON Schema.

Generate mock JSON from a GraphQL SDL type, extract clean JSON from a GraphQL response, or convert SDL to JSON Schema. Three modes, one tool.

Your data never leaves your browser
SDL → mock JSON
Response → clean data{}
SDL → JSON Schema
Always free
GraphQL to JSON — 3 modes   100% client-side
GraphQL SDL input
  Ready

      

GraphQL SDL → JSON type mapping

GraphQL scalarMock JSON valueJSON Schema type
String!"string_value"{"type":"string"}
Int!42{"type":"integer"}
Float!3.14{"type":"number"}
Boolean!true{"type":"boolean"}
ID!"1"{"type":"string"}
[String!]!["string_value"]{"type":"array","items":{"type":"string"}}
NestedType!{...}{"$ref":"#/$defs/NestedType"}
String (nullable)null{"type":["string","null"]}

Convert GraphQL to JSON online: mock data, responses and JSON Schema

"GraphQL to JSON" covers three different jobs and this converter does all of them in your browser. Mock data from your schema (SDL): enums rotate between values, interfaces and input types are parsed like object types, unions use their first member, custom scalars such as DateTime get realistic values, and recursive types (User → posts → author) stop at a reference instead of repeating forever. Response data: paste a GraphQL response and extract the data payload as plain JSON. JSON Schema: turn SDL types into a schema with enums, $ref definitions and anyOf for unions.

Going the other way? JSON to GraphQL generates types, input types, queries and mutations from a JSON sample. To build mock data from a JSON Schema instead of SDL, use JSON Schema to JSON.

All schema, apis & sql tools

GraphQL parsed in your
browser. No server needed.

The SDL parser uses regex to extract type definitions, field names and type modifiers without a full GraphQL parser library — no CDN dependency. Nested types are resolved recursively with a depth limit to prevent cycles. The Response mode simply extracts data from the GraphQL envelope — works with any valid GraphQL JSON response.

3 modes

SDL → Mock JSON for testing, Response → data for API debugging, SDL → JSON Schema for validation.

Nested type resolution

Nested GraphQL types are recursively resolved to generate realistic mock data for the full object graph.

Non-null aware

The ! modifier is respected — non-null fields get real mock values, nullable fields get null in the JSON Schema output.

52 tools, always free

No watermarks, no account. Funded by non-intrusive display advertising only.

Frequently asked questions

How do I generate mock JSON from a GraphQL schema?

Select the Mock JSON mode, paste your GraphQL SDL type definitions, enter the type name you want to mock (or leave blank for the first type found), and click Generate. Nested types are resolved automatically.

How do I extract clean JSON from a GraphQL response?

Select the Response mode, paste the full GraphQL JSON response (the one with data and errors fields), and click Extract. The tool pulls out the data field and formats it as clean JSON. If errors are present, they are also shown separately.

Is the GraphQL to JSON converter free?

Yes, completely free. No account required.

Can I convert a GraphQL schema to JSON Schema?

Yes. The JSON Schema mode maps scalars to JSON types, enums to "enum", object types to $defs with $ref, unions to anyOf and nullable fields to ["type", "null"].

Does it support enums, interfaces, unions and input types?

Yes. Enum values rotate between instances, interfaces and inputs are parsed like object types, unions use their first member type, and descriptions and directives in the SDL are ignored.
Go up