JSON Schema generator

Infer a schema from a sample payload — draft 2020-12 or draft-07.

About & FAQ ↓
Sample JSON
Waiting for input.
JSON Schema

Inference from a single sample is a starting point, not a contract — check optional fields, nullable values and numeric bounds before shipping it. ⌘/Ctrl + Enter regenerates.

Reference
Schema generator

About the JSON Schema generator

Writing a schema by hand for an existing API is tedious and error-prone. This infers one from a sample: types, nested objects, arrays, formats such as date-time, uuid and email, and closed sets of strings as enums. Array elements are merged rather than sampled, so the items schema describes every element — the union of their properties, with only the always-present keys marked required.

01

Draft 2020-12 or draft-07

Pick the draft your tooling expects; the output is ready to drop into a repository.

02

Arrays merged, not sampled

Every element shapes the result, so optional keys stay optional instead of vanishing.

03

Format detection

date-time, date, time, uuid, email, ipv4 and uri are recognised and annotated.

04

Enum detection

A string field that repeats a small set of values can be emitted as an enum.

How to use it

  1. Paste a representative payload — the more variation it contains, the better the schema.
  2. Choose the draft, and switch on the detections you want: formats, enums, examples, additionalProperties: false.
  3. Copy the schema, or download it as schema.json.

Questions

Which drafts can it emit?

Draft 2020-12 (the current one) and draft-07 (the one most tooling still targets).

How does it decide what is required?

A key is required only if it appears in every object of that shape in your sample. That is why feeding it an array with several varied elements gives a much better result than a single object.

Is the generated schema production-ready?

Treat it as a first draft. Inference from one sample cannot know your real bounds, nullability or optionality — check those before shipping it, then test it against real payloads with the schema validator.