JSON to Schema Generator
convert
output
About the JSON to Schema generator
Validate API responses and configs instead of guessing — this tool derives a JSON Schema from a paste of real JSON. You get a draft 2020-12 document with inferred types,properties, requiredfields, and array items, ready to hand to a validator in any language. Everything runs in your browser.
What gets inferred
Objects become object schemas with properties, and a key that appears in every instance lands in required. Arrays become array schemas with mergeditems. If a scalar field repeats a value across rows (like a status code appearing several times), the tool collapses it into anenum, which also makes the schema self-documenting.
Unions and null
Fields with mixed values produce an anyOf union, andnull always joins as an explicit{"type":"null"} member, so optional-but-nullable fields validate honestly. Integers are kept distinct from floats (integer vs number), and empty arrays fall back to an open {} items schema.
Related tools
Check documents against the inferred schema with the JSON Schema validator, or prefer compile-time types over runtime validation? Use the TypeScript generatorinstead, or tidy your example first with the JSON formatter.
FAQ
Which JSON Schema draft is produced?
Draft 2020-12, the current standard — declared via the $schema key so validators pick the right dialect.
Will `enum` break on missing data?
Enum is inferred only from the values you provide. If real traffic can contain other values, remove the enum before adopting the schema.