Generator

JSON Schema generator

Paste a sample payload and get a JSON Schema inferred from it — types, nested objects, array items merged across elements, plus optional format and enum detection. All in your browser.

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.

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.

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.