JSON Schema Generator
Paste one or more JSON samples and get a JSON Schema: types, required fields, nested objects and arrays, merged across every sample. Pick draft 2020-12 or 07. Nothing is uploaded.
Generate a JSON Schema from JSON in your browser, for draft 2020-12 or draft-07. Fields found in every sample are required, optional fields are detected from several samples, and formats such as date-time, email, uri and uuid are recognised. Nothing you paste is uploaded.
Separate several samples with a blank line or a line containing ---, or paste JSON Lines (one value per line). Pretty-printed samples need a blank line or --- between them.
0 samples
How to use the JSON Schema Generator
- Paste a JSON sample, or several. Separate samples with a blank line or a line containing ---, or paste JSON Lines.
- Choose the draft and options. The schema updates as you type, and the sample count is shown above it.
- Press Copy or Download schema.json.
The schema reflects only the samples you give it, so it is a starting point to review, not a final contract. Your options are remembered on this device; your JSON never is.
Frequently asked questions
How do I generate a JSON Schema from JSON?
Paste a JSON sample into the input. The schema appears instantly with the types, required fields and nested objects found in it. Pick draft 2020-12 or draft 07, then press Copy or Download schema.json.
Why should I paste more than one sample?
The schema reflects only the samples you give it. A field present in every sample is marked required, and a field missing from some is left optional. With one sample every field looks required, so paste several samples to get optional fields right.
How do I paste several samples?
Separate them with a blank line or a line containing ---, or paste JSON Lines with one value per line. Pretty-printed samples need a blank line or --- between them. An error names the sample number that failed to parse.
What happens when a field has different types in different samples?
The type becomes a list, for example string and null. Numbers that are whole in every sample are integer; if any sample has a decimal the type is number. Arrays are merged into one items schema.
Is my JSON uploaded anywhere?
No. The schema is generated entirely in your browser. Nothing you paste is sent to a server, and the text is never stored or added to the URL. Only your option choices are remembered on this device.
Fun facts about JSON Schema
- JSON Schema is itself written in JSON, and a schema can describe the schema format.
- Draft 2020-12 is the latest widely used draft; draft-07 is still common in older tools.
- A field that can be null is written with two types at once, such as type: ["string", "null"], rather than a separate null flag.
- Editors such as VS Code use JSON Schema to power completion and validation for config files.