Skip to content
{ }JSON Formatter

JSON to GraphQL Schema

Generate GraphQL SDL types from a JSON sample — nested types, list types and non-null (!) inferred from your data. Great for sketching a schema from an existing API response.

Input
Output
Paste input and press Generate GraphQL.

From a response to a schema sketch

Wrapping a REST API in GraphQL, or designing types to match data you already have? Paste a JSON sample and this tool infers GraphQL SDL: one type per object shape, scalars mapped by value (Int, Float, String, Boolean), and [T!] list types for arrays. Nested objects become their own named types, referenced from the parent — GraphQL resolves type references regardless of declaration order.

Non-null, inferred from the data

GraphQL marks required fields with a trailing !. A field is emitted as non-null only when it is present in every record and never null; anything that can be missing or null stays nullable. Untyped or genuinely mixed values fall back to a custom scalar JSON (declared automatically when needed), which you can wire to a JSON scalar implementation.

A starting point, not the whole schema

The output is the type definitions — add your Query/Mutation root, arguments, directives and relations to finish it. A key that isn't a valid GraphQL name is renamed with a note pointing back to the original. Need typed client models instead? JSON to TypeScript generates interfaces from the same sample.

Frequently asked questions

How is non-null (!) decided?

A field gets a trailing ! only when it appears in every record of the sample and is never null. Fields that are missing from some records, or null anywhere, are left nullable. List elements follow the same rule, so an array of always-present strings becomes [String!].

What happens to nested objects and arrays?

Each nested object becomes its own GraphQL type, referenced by name from the parent. Arrays become list types ([T]). GraphQL resolves type references regardless of order, so the output compiles as-is.

What is the JSON scalar in the output?

GraphQL has no built-in "any" type, so untyped or mixed values (and always-null fields) map to a custom scalar named JSON, which the tool declares with "scalar JSON" when it is used. Wire it to a JSON scalar resolver in your server.

Is this a complete schema?

It is the type definitions inferred from your data. Add Query/Mutation root types, field arguments, directives and relations yourself — the generated types are the tedious part done for you.