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.
GraphQL SDL → JSON type mapping
| GraphQL scalar | Mock JSON value | JSON 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.
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.
