JSON Schema Generator
Infers a draft JSON Schema from a sample document, including types, required keys and array item shapes.
Loading the tool…
How to use this tool
- Paste a document that is representative of the data, not an edge case.
- Decide whether every key present in the sample should be marked required.
- Select Generate schema, then add descriptions, formats and constraints by hand.
What json schema generator does
Writing a JSON Schema by hand for a large response is tedious, and most of it is mechanical. Inferring a first draft from a real sample gets the structure right immediately and leaves you to add the parts a sample cannot tell you: descriptions, formats, value constraints and which optional fields are genuinely optional.
Treat the output as a starting point rather than a finished contract. A single sample cannot distinguish a field that is always present from one that happened to be present this time, and a null in the sample says nothing about whether null is permitted. Feed it several representative documents and reconcile the drafts before publishing a schema.