JSON Schema Generator
JSON Schema Generator builds a JSON Schema from a sample JSON document, describing its types, nesting and required keys. When the sample is a list, the items are merged so keys missing from some of them become optional. It runs in your browser.
How to use JSON Schema Generator
- Paste a sample of your JSON. A list with several items gives better results than a single object.
- Choose the schema version and which extras to add.
- Copy or download the schema, then review it before using it to validate data.
Frequently asked questions
How good is a schema generated from one example?
It is a starting point. A schema can only describe what the sample shows, so it cannot know about value ranges, enums or keys that never appeared. Use several varied samples and edit the result.
How are optional keys decided?
When the sample is a list of objects, a key is marked required only if it appears in every item. For a single object, all of its keys are marked required unless you turn that option off.
Is my JSON uploaded anywhere?
No. The schema is generated in your browser.
Next step
Prefer types in code? Generate TypeScript interfaces from the same JSON. Open JSON to TypeScript.
Related tools
- 055