A JSON Schema is a contract for your data: it says which fields exist, what types they hold, and which ones are required. This tool writes that contract for you from a sample payload, in JSON Schema Draft 2020-12 — the current draft — so you can validate API responses, document endpoints, or generate forms from the schema.
How to use
- Paste a representative JSON sample — ideally one that shows every field and value variation you know about.
- Choose a schema title and whether enums and formats should be detected.
- Click Generate JSON Schema, then copy the schema or download it as
schema.json.
About this tool
The generator walks the sample recursively: objects become properties with a required list of fields present in every item of an array; arrays merge the schemas of all their items; strings are checked for email, date-time and URI formats when format detection is on; and a string field that takes only a few distinct values across the items of an array (ten or fewer by default) becomes an enum. Numbers get no invented minimum or maximum — the sample cannot prove a range, so none is claimed.
How do I use this tool?
- Paste your sample JSON into the box.
- Set the schema title and the enum/format options.
- Press Generate JSON Schema and copy or download the result.
Where is this tool used?
API teams use generated schemas to validate responses in tests, to document what an endpoint returns, and as the starting point for an OpenAPI contract. Frontend developers feed schemas into form generators, and data teams use them to check that imported JSON files match the expected shape before loading them.
What are the limitations?
One sample cannot prove a rule: a field that happens to be a string in your sample might also accept numbers in production, and an enum with two observed values might really allow five. The tool also never invents ranges, patterns or descriptions — add those by hand from your API documentation before you enforce the schema.
Frequently asked questions
What is a JSON Schema?
A JSON Schema is a document that describes the shape of JSON data — which fields exist, what types they hold, and which are required. Validators use it to check that a payload matches the contract before your code trusts it.
Which JSON Schema draft does this generate?
Draft 2020-12, the current draft. It uses $schema, $id-free output, type, properties, required, items and enum — all supported by modern validators such as Ajv.
How does enum detection work?
When a string field takes only a small number of distinct values across the whole sample (ten or fewer by default), the tool lists them as an enum. It is a hint from the sample, not proof — check against your API docs before enforcing it.
Is my JSON uploaded anywhere?
No. The schema is inferred entirely in your browser; your sample never leaves your device and is never stored.
Updated November 2026 · Built and tested by Sharjeel Tahir · How our tools are tested