Introspection JSON

GraphQL SDL

What is the Introspection JSON to SDL Converter?

When you grab a schema from Apollo Studio, Postman, Insomnia, or run get-graphql-schema against a live endpoint, what comes back is not the friendly SDL you wrote — it is the result of query { __schema { ... } }: 600+ lines of nested JSON describing every type, every field, and every modifier in a tree of kind / name / ofType objects. Useful to a tool, unreadable to a human. This converter takes that JSON and prints it back out as the SDL you would actually commit to a repository, following the introspection rules in the October 2021 GraphQL spec.

Everything happens in your browser — no upload, no AI, no schema sent anywhere. The conversion logic mirrors what graphql-js does internally with buildClientSchema and printSchema: walk the __schema tree, skip the introspection-only types (__Schema, __Type, __Field, …) and built-in scalars, and emit each remaining definition with its description, fields, arguments, default values, and deprecation reasons intact. Whether you paste the full { "data": { "__schema": ... } } envelope, just { "__schema": ... }, or even the bare __schema value, the page handles all three.

The output is grouped scalars first, then enums, interfaces, unions, input types, and finally object types — alphabetical inside each group, with two-space indentation and a blank line between definitions. Idempotent enough to drop straight into a <code>.graphql</code> file in your repo.

How to Use the Converter

Three steps. The buttons below are the actual buttons on this page.

1

Paste, Upload, or Load a Sample

Paste your introspection JSON into the left Input panel — conversion happens automatically a fraction of a second after you stop typing, so there is no Convert button to hunt for. Click Upload for a .json file you exported from Apollo Studio or Postman, or hit Sample to load a realistic Order/Customer/Money introspection result. A typical paste starts like this:

{
  "data": {
    "__schema": {
      "queryType": { "name": "Query" },
      "types": [
        { "kind": "OBJECT", "name": "Order", "fields": [...] },
        ...
      ]
    }
  }
}

You can also paste the inner { "__schema": ... } value or the bare __schema object — the page tries all three shapes. Tools like get-graphql-schema and Apollo Server's introspection endpoint produce one of these shapes by default.

2

Read the SDL Output

The right Output panel renders the schema as SDL. Each type is on its own definition with two-space indentation, fields one per line, descriptions kept above the type or field as triple-quoted block strings, and deprecation reasons rendered as @deprecated(reason: "..."). Built-in scalars and the __ introspection types are filtered out — what you get is exactly the schema your server publishes, the way Relay's GraphQL spec recommends documenting it. If the JSON is malformed or missing the __schema field, you get a friendly inline message instead of a stack trace.

3

Copy or Download

Hit Copy to grab the SDL for a PR description, doc, or chat. Hit Download to save as schema.graphql — drop it straight into your repo. The clear button on the input panel resets you to a blank state. Conversion is fully client-side; the introspection result never leaves the page.

When You'd Actually Use This

Capture a Schema From a Live Endpoint

You inherit a GraphQL service that has no schema file in the repo — only the running server. Run an introspection query, paste the JSON in here, and you have a starting schema.graphql committed in five minutes. Easier than wiring up buildClientSchema and printSchema from graphql-js just to do this once.

Read an Apollo Studio or Postman Export

The schema export from Apollo Studio is the introspection JSON. Same for Postman's "Save schema" button on a GraphQL request. Convert it here and you can actually skim the schema in a code editor instead of squinting at JSON.

Diff Two Snapshots of a Live Schema

Run introspection against staging and production, convert each to SDL, then diff the two files. Spotting a missing field or a renamed enum value is trivial in SDL and basically impossible in raw introspection JSON.

Generate Type Stubs From a Service You Don't Own

Need TypeScript types or React hooks for a third-party GraphQL API? Most code generators want SDL, not introspection JSON. Convert here, then feed the SDL into your codegen pipeline — graphql-react, graphql-codegen, or whatever your stack uses.

Common Questions

Does it require the full { "data": { "__schema": ... } } envelope?

No. The page accepts three shapes: the full GraphQL response envelope, just { "__schema": ... }, or even the bare __schema object. Whichever you paste, it finds the __schema root and works from there.

What if my JSON has no __schema field?

You get a friendly message: "Expected an introspection result. Couldn't find __schema field. Paste the JSON returned by the GraphQL introspection query." No crash, no stack trace.

Are descriptions and deprecation reasons preserved?

Yes. Type and field descriptions are emitted as triple-quoted block strings above the definition. Deprecated fields and enum values get @deprecated(reason: "...") on the same line. This matches the output of printSchema from graphql-js.

What about built-in scalars and the __ introspection types?

Filtered out. String, Int, Float, Boolean, and ID are implicit in SDL — they only appear in field types, not as top-level definitions. Same for __Schema, __Type, __Field, and the rest of the introspection meta-types.

Is the output guaranteed to round-trip back to the same introspection result?

Semantically, yes — the SDL describes the same schema. Byte-for-byte, no, because the order of types and fields can differ from your original source file. The output is alphabetised inside each group of definitions for stable diffs.

Is my introspection result sent to a server?

No. Conversion runs entirely in your browser. Nothing is uploaded, nothing is logged. Safe to paste schemas from internal or unreleased services.

Other GraphQL Tools

Once you have the SDL, these handle the rest: