How to generate a schema from JSON
- Paste a JSON document, or several separated by a line containing only
---. JSON Lines (one document per line) works too, and you can open or drop several files at once. - Adjust the options. The schema on the right updates as you type.
- Copy or download the result, or save it to your stash to validate data, generate TypeScript or Zod, and write docs.
What the options do
- Draft
- Sets
$schemaand which formats may be used:uuidneeds Draft 2019-09 or later anddateneeds Draft 7 or later. - Detect formats
- Adds
format(date-time, date, email, uri, uuid, ipv4) when every value of a field matches it. - Detect enums
- Turns small sets of repeated strings, such as a status field, into an
enum. Leave it off when the samples do not show every possible value. - additionalProperties: false
- Closes every object so unknown keys are rejected.
- Top-level array is a list of samples
- Treats
[{…}, {…}]as separate samples and describes one item instead of the array.
FAQ
Why give it more than one sample?
One sample only shows one shape. With several, the generator can tell which fields are always there (required), which are optional, and which can be null or change type.
Is the generated schema final?
Treat it as a strong first draft. It describes the samples it saw; add descriptions, tighten limits such as minLength or maximum, and review formats and enums before relying on it.
Are my samples sent anywhere?
No. The schema is generated in your browser, and nothing is uploaded.