JSON to JSON Schema Generator
Paste a JSON sample and generate a draft 2020-12 JSON Schema — types, properties and required fields inferred, live in your browser.
This json to json schema generator does the opposite of a schema viewer: instead of rendering a schema you already have, it reads a sample document and writes one. It infers types (down to integer vs number), builds the properties map, and lists required fields — for an array of objects it merges every element and marks a key required only when it appears in all of them. That makes it quick to infer schema from json for validation, documentation, or an OpenAPI model. Need to read a schema back afterwards? Pair it with our JSON Schema viewer, which draws a schema as a tree and validates data against it.
How it works
- 1
Paste JSON
Drop a representative document in the left pane. An array of similar objects gives the most accurate required list.
- 2
Read the schema
The right pane fills with a live draft 2020-12 schema — type, properties, items and required, all inferred from your sample.
- 3
Copy or download
Copy the schema or save it as a schema.json file to drop into your validator or docs.
Instant & 100% private — nothing is uploaded
Everything runs locally in your browser. Your code, text and files are processed on your own device and are never sent to a server — so there are no upload waits, no size limits from us, and nothing is ever stored or logged.
Frequently asked questions
- Which JSON Schema draft does it output?
- Draft 2020-12. The root carries the matching $schema URI so validators know exactly which dialect to apply.
- How does it decide the required fields?
- For a single object every key is required. For an array of objects, this json schema generator marks a key required only if it appears in every element.
- Does it tell integers apart from other numbers?
- Yes. A whole number is typed "integer" and a fractional one is typed "number", so the inferred schema is tighter than a plain number-for-everything guess.
- How is this different from the JSON Schema viewer?
- This tool generates a schema from sample data. The viewer goes the other way — it visualises an existing schema as a tree and validates documents against it. They pair well.
- Is anything uploaded?
- No. The schema is inferred locally in your browser, so your sample data never leaves the page.
More tools
More from the Hivly network
Free sister tools on our other sites.