Don't like ads? Go Ad-Free Today

JSON to GraphQL Type Definitions Generator

DataDeveloperText
ADVERTISEMENT · REMOVE?
ADVERTISEMENT · REMOVE?

Guide

JSON to GraphQL Type Definitions Generator

JSON to GraphQL Type Definitions Generator

Paste any JSON object or array and instantly receive a GraphQL Schema Definition Language (SDL) document that describes its shape. The generator walks the JSON tree, infers scalar types, names nested objects, merges array-of-object variants, and emits an optional root Query type so the output is ready to drop into a server like Apollo, Yoga, Mercurius, or graphql-go.

Why a Deterministic JSON to GraphQL SDL Converter Matters

Hand-writing GraphQL types from a sample payload is mechanical but error-prone. A single missed nullable, an inconsistent Int vs Float, or a forgotten non-null marker on a list element can break code generation for every downstream client. A rules-driven generator treats the same JSON sample identically every time, which makes it safe to regenerate on every API change.

How to Use

  1. Paste a JSON object or array into the input box, or click Try an example to load a representative payload.
  2. Set the Root Type Name if you want something other than Root.
  3. Choose a Field Nullability strategy – strict (!) for required fields or all nullable for prototyping.
  4. Toggle ID Detection to auto-promote id and *Id keys to the GraphQL ID scalar.
  5. Optionally include a root Query type with single-entity and list-entity fields.
  6. Copy the SDL or download it as schema.graphql.

Features

  • Scalar Inference – distinguishes String, Int, Float, Boolean, and ID deterministically.
  • Nested Object Types – generates a separate named type for every nested object using PascalCase from the field key.
  • Array of Object Merging – unions every field across array items so optional fields are correctly marked.
  • Nullable vs Non-Null Toggle – emit strict ! markers or relax everything to nullable for early prototypes.
  • Auto ID Detection – upgrades id, userId, orderId style keys to the ID scalar.
  • Root Query Scaffold – optional type Query { ... } with single and list resolver signatures.
  • Client-Side Only – your JSON never leaves the browser, so the tool is safe for sensitive payloads.

Type Inference Rules

  • Integer numbers map to Int; numbers with a fractional part map to Float. A field seen as both promotes to Float.
  • Strings map to String. With ID detection on, keys named id or ending in Id become ID.
  • Booleans map to Boolean.
  • null values mark the field as nullable so the generated SDL skips the trailing !.
  • Empty arrays default to [String] because no element type can be inferred safely.
  • Arrays of objects merge into one named type; fields missing from any element become nullable automatically.

Who Uses It

  • Backend engineers wrapping a REST endpoint or a JSON file in a GraphQL gateway.
  • Frontend developers prototyping a schema against a fixture payload before the API is ready.
  • API designers documenting third-party response shapes as a typed contract.
  • Code-generation pipelines that need a reproducible SDL artefact from a stable JSON sample.

ADVERTISEMENT · REMOVE?

FAQ

  1. What is GraphQL SDL?

    Schema Definition Language is GraphQL's text-based syntax for describing types, fields, queries, and mutations exposed by an API. It uses keywords like type, scalar, enum, and input to declare the shape of data a server can return and the operations a client can call.

  2. Why does GraphQL use the ! (non-null) marker?

    An exclamation mark after a type declares that the field can never resolve to null. It lets clients skip null-check defensive code and lets the server fail fast if a required value is missing. Without it, GraphQL treats every field as nullable by default.

  3. When should a field use the ID scalar instead of String?

    The ID scalar is reserved for opaque identifiers used to refetch or cache an object - primary keys, UUIDs, slugs, foreign keys. It is serialised as a string but signals identity rather than display content, which helps clients like Apollo and Relay build their normalised caches correctly.

  4. How does GraphQL handle lists of objects in SDL?

    Lists are written with square brackets, such as [Order!]!. The inner ! means each element in the list is non-null, and the outer ! means the list itself is non-null. Inferring the right element type from a JSON sample requires unioning the field shapes across every item in the array.

Want To enjoy an ad-free experience? Go Ad-Free Today

Install Our Extensions

Add IO tools to your favorite browser for instant access and faster searching

Add to Chrome Extension Add to Edge Extension Add to Firefox Extension Add to Opera Extension

Scoreboard Has Arrived!

Scoreboard is a fun way to keep track of your games, all data is stored in your browser. More features are coming soon!

ADVERTISEMENT · REMOVE?
ADVERTISEMENT · REMOVE?
ADVERTISEMENT · REMOVE?

News Corner w/ Tech Highlights

Get Involved

Help us continue providing valuable free tools

Buy me a coffee
ADVERTISEMENT · REMOVE?