JSON to GraphQL Schema Generator Online
Turn a JSON sample into GraphQL SDL type definitions, right in your browser. Nothing you paste is uploaded.
The JSON to GraphQL Schema Generator runs entirely in your browser. The JSON sample you paste and the SDL it produces are never uploaded to ArrayKit.
Open the JSON to TypeScript Converter
About JSON to GraphQL Schema
JSON to GraphQL Schema converts a JSON sample into a ready-to-use GraphQL SDL document. Paste an object and it infers a `type Root` block, mapping numbers to Int or Float, strings to String, booleans to Boolean, and any key named id to the ID scalar. Arrays become non-null list types like [String!]!, and nested objects are broken out into their own named types (PascalCase from the field key) so the schema stays readable instead of deeply inlined. It is useful when you are prototyping a GraphQL API from a sample response, migrating a REST endpoint, or sketching resolvers before the backend exists. Set a custom root type name, copy the generated SDL, or download it as a .graphql file. Everything runs locally in your browser — your JSON sample is never uploaded anywhere.
Features
- Infers a full GraphQL `type` block from any JSON object
- Maps numbers to Int or Float based on whether they are whole numbers
- Recognizes an "id" field and types it as GraphQL's ID scalar
- Turns nested objects into their own named types automatically
- Arrays become non-null list types, e.g. tags: [String!]!
- Deduplicates repeated nested type names across the schema
- Custom root type name field, defaulting to "Root"
- Copy the SDL or download it as a .graphql file, all client-side
How to use the JSON to GraphQL Schema
- Paste a JSON object into the input pane, or load the example
- Optionally set a root type name
- Review the generated GraphQL SDL on the right
- Copy the schema or download it as a .graphql file
Example
Input
{"id":1,"name":"Ada"}
Output
type Root {
id: ID!
name: String!
}
The id field is typed as ID, and name becomes a non-null String.
Common errors & troubleshooting
- Every field is required (String!) but some responses omit that key. — Include a representative sample with `null` for fields that can be missing — the JSON to GraphQL Schema Generator makes null or absent values nullable instead of appending !.
- An array field produced [String]! instead of a typed list. — Provide at least one non-null element in the sample array so the tool can infer its element type; empty arrays fall back to [String].
- Two different nested objects generated the same type name. — Rename one of the JSON keys before pasting, or rename the type in the generated SDL afterwards — the generator dedupes by name, so identical keys share one type.
- Banner shows "Invalid JSON" and no schema appears. — Check for a trailing comma, unquoted key, or single quotes — the tool needs strict JSON, and the error message includes the line and column to fix.
Frequently asked questions
- What does the JSON to GraphQL Schema Generator produce?
- It reads a JSON sample and outputs GraphQL SDL — one or more `type` blocks with field names and inferred scalar, list, or object types — that you can drop straight into a GraphQL schema file.
- How does it decide between Int, Float, ID, and String?
- Whole numbers become Int and decimals become Float; any field literally named "id" is typed as GraphQL's ID scalar; text becomes String and true/false becomes Boolean.
- Does the JSON to GraphQL tool handle nested objects and arrays?
- Yes. Nested objects turn into their own named GraphQL type (PascalCase from the field key), and arrays become non-null list types such as [String!]!, inferring the element type from the first item.
- Can I rename the generated root type?
- Yes. Use the root type name field — it defaults to "Root" but you can set it to anything, such as "User" or "Product", before copying the schema.
- Is my JSON sample uploaded anywhere?
- No. The JSON to GraphQL Schema Generator runs entirely in your browser. The JSON you paste and the SDL it generates never leave your device.
- What happens with invalid or malformed JSON?
- The tool shows an error banner naming the problem and, where possible, the line and column, instead of generating a broken schema.
Related tools
All ArrayKit tools