Skip to content
100% local

JSON to GraphQL SDL

Turn a JSON document into GraphQL types written in Schema Definition Language.

Input
Output

JSON to GraphQL SDL

Paste a JSON object or an array of objects and this tool derives GraphQL types written in Schema Definition Language. It is a fast way to bootstrap a schema from a real API response, a database export or a sample payload, instead of typing every field and type by hand.

Scalars are inferred from the JSON values: strings become String, whole numbers become Int, decimals become Float, and true/false become Boolean. A field named "id" is typed as ID when it holds a string or an integer, matching how most GraphQL APIs identify records. Fields whose sample value is null are marked optional; every other field gets the required marker ("!"). Nested objects become their own named types, referenced from the parent, and structurally identical nested objects are merged into a single type instead of being duplicated. Arrays become list types with the element type inferred from their contents.

Two more options shape the output: turning on the custom-scalar option recognizes ISO date and date-time strings and declares "scalar Date" or "scalar DateTime" instead of treating them as plain String, and the "Generate as" choice switches between a "type" (for queries) and an "input" (for mutation arguments). Enabling "Include Query type" adds a small Query type with one field returning the root type, so the schema is ready to paste into a server or a schema-first tool as-is.

Everything runs locally in your browser — the JSON you paste is never uploaded anywhere. Copy the generated SDL, download it as a .txt file, or send it straight into another tool's input to keep working on it.

FAQ

How does it decide whether a field is required?
A field is marked with "!" (required) unless its sample value in the JSON is null, in which case it is left optional.
How are nested objects and lists handled?
Each nested object becomes its own named GraphQL type referenced from its parent. Identical nested shapes are reused as one type. Arrays become list types, with the element type taken from the array's contents.
What does "Detect ID from 'id' field" do?
When enabled, any field literally named "id" that holds a string or a whole number is typed as GraphQL's built-in ID scalar instead of String or Int.
Can I generate GraphQL input types instead of object types?
Yes. Switch "Generate as" to "input" to get input Name { … } blocks, useful for mutation arguments. The Query wrapper is only added for "type" output, since a Query field cannot return an input type.
Is my JSON uploaded anywhere?
No. The conversion runs entirely in your browser — your JSON never leaves your device.