Zero Signup ToolsFree browser tools

Developer Tools

JSON to GraphQL Schema Generator

Paste any JSON and get a ready-to-mount GraphQL SDL schema with type declarations, ID, Date, DateTime scalars, nullability, and an optional Query block.

0 chars

JSON is parsed locally with the browser's built-in JSON.parse. The schema is generated on your device. Nothing is uploaded.

Output options

Every change re-renders the schema instantly. The JSON you paste here stays in your browser.

Converted to PascalCase. Nested types are named from their parent key, also in PascalCase, with -2, -3 suffixes on collision.

The single field name on the generated Query type. Leave blank to derive it from the root: object roots use camelCase, array roots pluralize the element name.

Indent

Nullability default

Permissive matches GraphQL convention: leave every field nullable unless a null or missing value was actually observed. Strict adds `!` to fields that were always present and never null in the sample data.

How the inference works

Scalars

Integers within the signed 32-bit range become Int. Numbers with a decimal or outside the Int range become Float. Booleans become Boolean. Strings become String unless they match an ID or date heuristic.

Objects

Each unique object shape is promoted to its own named type. Nested types are named after the parent key in PascalCase. Identical shapes reuse the same type when their fields match.

Lists

Arrays become a [Type] list. The element type is the union of every observed element. Element singularization picks Post out of posts, Story out of stories, and so on.

Nullability

Permissive mode (default) leaves every field nullable to match the GraphQL convention. Strict mode adds ! to fields that were always present and never null. Observed nulls and missing keys are always nullable in either mode.

ID detection

Strings under a key named id, uuid, *Id, or *_id are typed as ID. Disable detection to keep them as String.

Custom scalars

ISO-8601 dates emit Date or DateTime scalar declarations at the top of the schema. Mixed-type fields fall back to a JSON scalar with a warning.

How to use

  1. Paste a JSON value into the input on the left, or click Load sample JSON to see a worked example.
  2. Pick the root type name (defaults to Root, converted to PascalCase) and a Query field name (defaults to the camelCased root, or its plural for list roots).
  3. Choose Permissive or Strict non-null. Permissive keeps every field nullable to match GraphQL convention; Strict marks always-present, never-null fields with !.
  4. Toggle Detect ID fields and Detect Date and DateTime to control the ID, Date, and DateTime scalar heuristics. Toggle Emit Query type if you want a mountable Query block at the bottom.
  5. Read the generated SDL in the panel on the right, review the scalars used and any warnings, and copy the whole schema with one click.

About this tool

JSON to GraphQL Schema Generator turns a sample JSON payload (a REST response, a fixture, an export) into a complete GraphQL Schema Definition Language (SDL) document you can drop straight into apollo-server, graphql-yoga, Mercurius, Pothos, or a graphql-tools setup. The generator parses your input with the browser's native JSON.parse and walks the resulting tree to infer scalar types, named object types, list types, and nullability. Scalar inference splits numbers into Int and Float by checking each sample against the GraphQL Int range (signed 32-bit, -2147483648 to 2147483647) and whether any sample has a non-integer value; Booleans map to Boolean; Strings map to String, with two opt-in heuristics. The ID heuristic types any string under a key called id, uuid, *Id, or *_id as the GraphQL ID scalar; the date heuristic types ISO-8601 date strings (YYYY-MM-DD) as Date and ISO-8601 date-time strings (YYYY-MM-DDTHH:MM:SS with an optional offset) as DateTime, emitting matching scalar declarations at the top of the schema for the custom types so downstream tooling can attach resolvers. Object inference promotes every distinct shape into its own named type. Names are derived from the key in PascalCase, with collision suffixes (Address, Address2, Address3) so two structurally different shapes that happen to share a key do not clobber each other. Inside arrays, the element type name is singularized first (posts becomes Post, stories becomes Story, addresses becomes Address) so the SDL reads naturally. Nullability has two modes. Permissive matches the GraphQL convention: every field is nullable unless you say otherwise, which is the safe default for clients. Strict adds the ! non-null marker to fields that were always present and never null in the sample data, but it still keeps observed nulls and missing keys nullable so the schema reflects reality. Mixed-type fields fall back to a JSON scalar with a warning so you can decide on a union or interface manually. Keys that are not valid GraphQL identifiers (kebab-case, leading digits, spaces, dots) are renamed to a safe identifier and the original key is preserved in a SDL comment above the field. The optional Query block emits a single root field named from the root type (camelCased for object roots, pluralized for list roots) so the schema is mountable out of the box; the field name is editable. Everything runs in your browser, no JSON ever leaves the page, and the result includes a list of scalars used, every generated type, and any warnings to review.

Free to use. Works in your browser. No signup, no login.

Related tools

You may also like

All tools
All toolsDeveloper Tools