JSON to GraphQL SDL Converter
Infer types, nullability, IDs and enums from a JSON sample.
JSON sample
20 lines · 274 charsInferred SDL
2 types · 6 fields · 0 enumstype Address {
city: String!
zip: String!
}
type Root {
id: ID!
name: String!
email: String
address: Address!
}
type Query {
root: [Root!]!
}
Details
Paste an object or array of objects and get a GraphQL schema definition language starting point. The inferencer counts field presence and null values across every sampled object, maps scalars to Int, Float, Boolean and String, applies an ID heuristic to id-like keys, suggests enums for repeated short string values, and turns nested objects into named types with PascalCase names. Heuristics are toggleable because inferred schemas always need human review.
More examples
Users with addresses
[{"id":1,"name":"Ada","address":{"city":"London"}}]Produces type Root with an address field and a separate type Address.
Nullability
[{"email":"a@b.test"},{"email":null}]A field that is null or absent in any sampled object becomes nullable.
Enum candidate
Six rows alternating between active and pending statusEmits an enum type with uppercase members and lists the suggestion.
Examples
Users
[{id:1,name:'Ada',address:{city:'London'}},{id:2,name:'Grace'}]type Root { id: ID! name: String! address: Address }
type Address { city: String! }The absent address in the second row makes the field nullable.
Enum candidate
Six rows with status active or pendingenum StatusEnum { ACTIVE PENDING }Repeated short strings with enough occurrences become an enum suggestion.
Mixed types
[{value:1},{value:'one'}]value: StringMixed scalar types fall back to String with a warning.
About this tool
JSON to GraphQL SDL Converter infers a schema definition from a JSON sample. Nested objects become named types, arrays become lists, and every field's nullability is decided by a presence census across all sampled objects.
Scalar mapping follows GraphQL's built-ins: integers become Int, fractional numbers Float, booleans Boolean and everything else String. An ID heuristic recognises id and *Id keys whose values look like identifiers, and an enum heuristic suggests enum types for short repeated strings. Both heuristics are toggleable.
The output is a starting point, not a finished schema. The tool reports warnings for mixed types and sampled arrays and never sends your JSON anywhere; all inference runs in the browser.
What this tool does not do
- Inference is heuristic; the generated SDL always needs human review.
- Custom scalars, interfaces, unions, directives and resolvers are not generated.
- Sampling stops at 1000 array elements.
- Date and time strings remain String; no custom DateTime scalar detection.
- Nested arrays of arrays are simplified rather than fully modelled.
How to use this tool
Paste a sample
Provide an object or an array of objects, ideally with enough rows to expose nullable fields.
Set the root name and options
Choose the root type name and toggle enum, ID or nullable-all inference.
Review the SDL
Read the type count, field census and warnings; rename types to match your domain.
Copy the schema
Copy or download the .graphql file and continue with resolvers and directives.
Use cases
GraphQL bootstrapping
Start a schema from an existing REST response instead of writing types by hand.
Prototyping
Mock a schema shape for fixtures and front-end development.
Reverse engineering
Recover a likely schema from exported sample data.
Inference rules
| Observation | SDL |
|---|---|
| Integer value | Int |
| Fractional value | Float |
| Boolean value | Boolean |
| id or *Id key with identifier-like values | ID |
| 2–5 repeated short strings | suggested enum type |
| Field null or absent in any sample | nullable field |
| Nested object | separate named type |
Only the first 1000 objects in a large array are sampled; the tool warns when this happens.
Common mistakes
Mistake:Trusting inferred nullability from a tiny sample.
Fix:Use enough objects to cover optional fields, then review nullable markers manually.
Mistake:Assuming every id-like string is an ID scalar.
Fix:Turn ID detection off for descriptive strings; the heuristic checks length and shape.
Mistake:Accepting enum suggestions without review.
Fix:Enums are suggestions; real domains may add values later.
Mistake:Expecting resolvers or directives.
Fix:This tool emits SDL types only, not server code.
Mistake:Feeding an array of scalars.
Fix:Provide objects or an array of objects so there are fields to infer.
Frequently asked questions
How is nullability inferred?
The converter runs a presence census over every sampled object. A field is marked non-null only when it is present and non-null in every sample that could contain it; a missing or null value in one row makes the field nullable. Small samples are a common source of overly strict schemas, so the tool warns when only a handful of objects were seen.
How are enums detected?
Short string values that repeat across the sample are collected per field. When a field has a small set of distinct values with enough occurrences, the tool suggests an enum type using normalized, GraphQL-safe member names. Enum detection is a suggestion you can disable; values added later in a real API will not be predicted.
Why did my nested object become a separate type?
GraphQL fields cannot contain inline object shapes. Each nested object is promoted to a named type derived from the field name, and the parent field references that type. Deeply nested structures therefore produce several types, which you can rename to match your domain before using the SDL.
Can it handle arrays of mixed shapes?
Yes. Fields are unioned across all array elements, and a field absent from some elements becomes nullable. When the same field carries incompatible scalar types the converter falls back to String and emits a warning rather than inventing a custom scalar. Only the first 1000 elements are sampled from very large arrays.
Are names and scalars customizable?
The root type name, an optional prefix and suffix for generated types, and the ID/enum/nullability heuristics are configurable. Built-in scalars are used for numbers, booleans and strings; dates and other domain-specific values remain String because the tool does not invent custom scalars.
Does the generated SDL include resolvers or directives?
No. The output is schema definition language only: types, fields and suggested enums. Resolvers, query and mutation roots, directives, interfaces and unions are deliberately out of scope and should be added by hand.
Is my JSON uploaded anywhere?
No. Parsing, the field census and SDL generation all run in your browser tab. Nothing is transmitted, and the sample is not stored after you leave the page.
References & standards
Related tools
.env Secret Safety Linter
Validate .env syntax and spot likely leaked credentials or placeholder secrets.
.gitattributes Generator
Build .gitattributes rules for line endings, Git LFS, GitHub linguist marks and merge drivers — with a one-line explanation for every rule.
.htaccess Generator
Build an Apache .htaccess — HTTPS redirects, rewrites, error pages, security headers, and basic auth
2D Fluid Dynamics & Particle Physics Sandbox
A physics playground with two engines sharing one canvas. The fluid mode runs a real Eulerian Navier-Stokes solver — semi-Lagrangian advection, explicit diffusion, Jacobi pressure projection and vorticity confinement — that you paint with dye and velocity using mouse or touch. The particle mode is a damped Verlet N-body engine with gravity wells, Coulomb attractors and repulsors, spring links, wall restitution and elastic circle collisions. Particle counts adapt to the device (100k target on WebGL2 desktop, 2k-5k on CPU fallback), and every configuration exports as runnable code: a Matter.js world, a PixiJS ticker setup, or a standalone vanilla Canvas engine.
A/B Test Sample Size Calculator
Compute required sample size per variant and test duration from baseline conversion rate, minimum detectable effect, alpha and power.
ABA Routing Number Validator
Validate 9-digit US ABA routing numbers with 3-7-1 Mod-10 breakdown.