JSON Schema Generator
Infer a JSON Schema from a sample payload.
Runs in your browser — your data never leaves it
Paste, type, or drop a file. Runs as you type.
Output appears here as you type.
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.