JSON to GraphQL Types
Paste a JSON sample and get GraphQL SDL (Schema Definition Language) type definitions for it. Scalars are inferred as Int, Float, String or Boolean; nested objects become their own types; arrays become lists; and nulls map to a sensible default. Put a JSON response or configuration sample in one side and type definitions come out the other — everything runs on your device.
🔒 100% Client-Side & Private — processed locally in your browser. Files never leave your device.
Options
Your result will appear here
Type or paste your input above, adjust the options, then press Run. Tip: press Ctrl+Enter to run, and ? for every shortcut.
How it works
From a JSON sample to GraphQL SDL
Paste a JSON object and the generator walks it in one pass: strings become String, booleans Boolean, integers Int, floats Float and null a String placeholder. Nested objects become their own types, arrays become list types, and the whole document is emitted as Schema Definition Language with one type block per object.
How arrays and names are derived
An array of strings maps to [String]. An array of objects becomes a list of the singularized type name, so an items field of objects yields type Item and items: [Item]. Colliding names get a numeric suffix, and a mixed-typed array falls back to [String] with a note suggesting a union type. The top-level object takes the Root type name value.
Nullability and indent
By default every field is nullable, an honest reading of a single sample. Mark non-null fields with ! appends ! only to fields whose sample holds a concrete value, leaving nulls plain. The indent option switches the emitted blocks between two and four spaces.
Where a single sample falls short
An empty array cannot reveal its item type, so it becomes [String], and a key that is missing from the sample never appears in the schema. Two different objects that share a field name collapse into one type, so the output is a starting point for a schema, not a complete model. Input must be valid JSON under one million characters.
The sample never leaves this tab
The JSON is parsed and the SDL generated entirely in the browser, so an API response or internal configuration sample is never posted anywhere.
Questions
How are scalars mapped?
Strings map to String, booleans to Boolean, integers to Int and floats to Float. null gets a default scalar (String) so a missing value never breaks the schema.
What about arrays?
Arrays become list types: an array of strings maps to [String]. If the items are objects, each object becomes a type and the field becomes a list of that type.
Is every field nullable?
By default fields are nullable (no !), which is the safe choice for a sample. Turn on "Mark non-null fields with !" to add ! to every field that holds a concrete value.
How is the top-level name chosen?
The top-level object gets the name you provide in "Root type name"; nested objects are named after their field (camelCase → PascalCase). You can rename freely afterwards.
Related tools
See categoryJSON to Go Struct
Generate idiomatic Go structs with json tags from a JSON sample, ready for encoding/json round-trips.
JSON to TypeScript
Generate TypeScript interfaces or type aliases from a JSON sample, with nested named types.
JSON to Zod Schema
Generate a Zod schema from a JSON sample so you can validate runtime data and infer clean types.
JSON Schema to TypeScript
Turn a JSON Schema into TypeScript interfaces and types, including $defs, unions and enums.