Skip to content

JSON to GraphQL Schema

Draft a GraphQL type definition from a sample JSON response.

Only fields present in every sampled record are marked non-null — relaxing a non-null later is a breaking change for clients.

Quick Tool Overview

The JSON to GraphQL Schema converter drafts SDL type definitions from a sample response: a type per nested object, list types for arrays, non-null markers on fields that are always present, and the ID scalar for identifier fields.

What it does
Drafts GraphQL SDL types from a JSON sample
You give it
A representative API response
You get back
Type or input definitions in GraphQL SDL
Best for
Wrapping a REST endpoint in a GraphQL layer
Developer Tools Free, unlimited use No sign-up Runs in your browser

About the JSON to GraphQL Schema

Wrapping a REST endpoint in GraphQL starts with writing types that mirror the response, and that first draft is mechanical. Paste the JSON and get SDL: a type per nested object, list types for arrays, and the built-in scalars mapped from the values.

Fields present in every record are marked non-null with an exclamation mark; the rest are nullable, which is the GraphQL default and the safer choice for anything coming from an upstream service. Keys named id, _id or uuid are typed as the ID scalar rather than String, since that is what clients expect for cache keys. You can also emit input types instead, for the mutation arguments that mirror the same shape.

Key features of the JSON to GraphQL Schema

ID scalar detection

Keys named id, _id or uuid are typed as ID, which is what clients such as Apollo use as the normalised cache key.

Honest nullability

Only fields present in every sampled record are marked non-null, because relaxing a non-null later is a breaking change for clients.

Types or inputs

Emit output types for queries, or input types for the mutation arguments that mirror the same shape.

Nested types named

Each nested object becomes its own named type rather than being inlined, which is the only form SDL allows.

List types spelled correctly

Arrays become [Type!] with the inner non-null marker where it belongs, which is the part hand-written SDL usually gets wrong.

How to use the JSON to GraphQL Schema

  1. 1

    Paste a sample response

    One representative payload from the endpoint you are wrapping.

  2. 2

    Name the root type

    Nested types take their names from the keys that hold them.

  3. 3

    Choose type or input

    Output types for queries, input types for mutation arguments.

  4. 4

    Copy into your schema

    Paste the SDL into your schema file and wire up the resolvers.

Frequently asked questions

No, only the type definitions. Resolvers are where your actual business logic lives, and no generator can infer that from a payload.

Reviews of the JSON to GraphQL Schema

What people who use the JSON to GraphQL Schema think of it. Reviews come from visitors and are posted as written.

No ratings yet

Yours would be the first.

  • 5 0 reviews rated 5 stars
  • 4 0 reviews rated 4 stars
  • 3 0 reviews rated 3 stars
  • 2 0 reviews rated 2 stars
  • 1 0 reviews rated 1 star

Write a review

Used this tool? Your rating helps the next person decide.

Your rating

Plain text only — links, email addresses and HTML are not accepted. Your name and review are shown publicly; nothing else is collected. See the privacy policy.

0 reviews

Newest first

No reviews yet

Be the first to rate the JSON to GraphQL Schema. It takes half a minute and no account.

Write the first review

More developer tools