Generate a GraphQL schema from JSON. Paste a sample payload and get SDL type definitions for every nested object, with lists, Int versus Float, ID fields and non-null markers worked out from the data — plus a query that selects every field. Anything that needs a decision, like a field that mixes types, is listed. It's free, runs in your browser, and nothing is uploaded.
| JSON | GraphQL |
|---|---|
| "text" | String |
| 42 | Int |
| 4.2 | Float |
| true | Boolean |
| id: 42 / "a1" | ID |
| [ … ] | [Type] |
| { … } | type Name { … } |
Whole numbers become Int and decimals become Float, based on every value in the sample.
When it's present in every object and never null. Fields missing from some items, or sometimes null, stay nullable.
ID is GraphQL's identifier scalar; clients like Apollo and Relay use it for caching. Turn the option off to keep Int or String.
GraphQL names can't contain hyphens, so they become firstName and are listed below the options.
No. Everything runs in your browser.
The generator infers one shape from the whole sample, merging every object in an array so fields that appear only sometimes aren't lost, then writes a GraphQL type for each object, root first. Scalars map to GraphQL's built-ins: whole numbers to Int, decimals to Float, text to String, booleans to Boolean, and — optionally — keys named id or ending in Id or _id to ID, which GraphQL clients use for caching. Arrays become list types, with the item type named from the singular of the key. With non-null on, a field that is present in every sample and never null gets !, including inside lists ([Post!]!), while optional or nullable fields stay nullable. Keys that aren't valid GraphQL names, such as first-name, are converted to camelCase and listed, and fields that mix types or are only ever null are typed as String with a note suggesting a union or custom scalar. A query that selects every field, nested to any depth, is generated alongside the schema.