JSON Schema Generator
Infer a JSON Schema from a sample payload.
Your data never leaves your browser
This tool runs entirely on your computer. What you paste or drop is never uploaded, never stored and never seen by us — close the tab and it's gone. How we know
Sign up to run — no credit card required.
Press Run to see the output. Sign up takes ten seconds — no credit card required.
Worked example
{"id":1,"name":"x","ok":true}{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"ok": {
"type": "boolean"
}
},
"required": [
"id",
"name",
"ok"
]
}This example is one of JSON Schema Generator's test cases — if the tool stopped producing this output, the build would fail.
Questions
- Which JSON Schema version?
- Draft 2020-12. Every property present in your sample is marked required — a sample can't tell us what's optional, so it errs toward strict and lets you relax it.
- How are arrays of mixed types handled?
- As an anyOf union of the item schemas rather than guessing a single type. Heterogeneous arrays are real data, not an error.
- Does it tell integers from floats?
- Yes — 1 is integer, 1.5 is number, which matters when the schema drives validation.
Related tools
JSON Formattertakes json
Pretty-print and indent JSON — in your browser, nothing uploaded.
JSON Validatortakes json
Check whether JSON is valid and see the first error.
JSON to CSVtakes json
Turn a JSON array of records into CSV, with proper escaping.
JSON Minifiertakes json
Strip whitespace from JSON down to the smallest valid form.