JSON to GraphQL Types Generator
Turn sample JSON into GraphQL SDL type definitions. Infers String, Int, Float, Boolean and ID scalars, generates a named type for every nested object, wraps arrays in list types, and marks fields non-null (!) unless they are null or missing in the samples. Runs entirely in your browser.
Input
Name of the GraphQL type generated from the top-level object.
Strict marks a field non-null (!) when it is present and non-null in every sample.
Infers the ID scalar from id-ish key names, for string values only.
Prepends type Query { … } so the output is a usable schema root.
Output
Guides
Paste a sample of JSON and get back ready-to-use GraphQL SDL type definitions. This tool inspects the shape of your data — the keys, the value types, how objects nest, and what your arrays contain — and writes the matching type blocks for you, so you can bootstrap a GraphQL schema from an existing API response, database row, or config file in seconds.
It is built for the common, tedious first step of schema design: you already have JSON, and you want the equivalent GraphQL types without hand-typing every field and remembering every non-null marker.
How to use it
- Paste a JSON object (or an array of objects) into the input box.
- Optionally change the Root Type Name — the name given to the type generated from your top-level object. It defaults to
Root. - The GraphQL SDL appears instantly on the right, ready to copy or download as
schema.graphql.
Because it updates as you type, you can tweak your JSON and watch the schema change live.
How types are inferred
- Scalars map from the JSON value: strings become
String, whole numbers becomeInt, decimals becomeFloat, andtrue/falsebecomesBoolean. - ID detection: any field whose key is literally
id(in any case) is typed as GraphQL'sIDscalar instead ofStringorInt. - Nested objects each get their own named
typeblock, named after the parent key in PascalCase (address→type Address). - Arrays become list types. An array of scalars becomes something like
[String!]; an array of objects generates a named type from the field name in PascalCase (items→type Items) and produces[Items!].
When is a field non-null?
GraphQL uses a trailing ! to mark a field as non-null. This generator adds ! unless it has a reason not to:
- If a field's value is
nullin your sample, it is left nullable. - If you provide an array of objects and a field is missing from at least one of them, it is treated as nullable across the merged type.
- Otherwise the field is non-null.
Providing several representative objects in an array therefore produces a more accurate schema than a single sample, because presence and absence across the samples drive nullability.
Why pass an array of objects?
A single object only tells the tool which fields can exist. An array lets it see which fields are always present versus sometimes missing, and it widens scalar types when samples disagree (an Int in one and a Float in another becomes Float). The result is a schema that reflects the real variability of your data.
Is my data uploaded anywhere?
No. All parsing and type generation runs entirely in your browser — your JSON never leaves your device and nothing is sent to a server. That makes it safe to use on internal API payloads or data you would not want to paste into a remote service.
What are the limits?
The generator is intentionally simple and deterministic. It does not attempt language-aware singularization of array names, it does not infer enums or custom scalars, and it treats mixed or ambiguous values by widening to String. Use the output as a strong starting point, then refine field names, add directives, and split types as your schema matures.