JSON Schema Generator
Infer JSON Schema Draft 2020-12 or Draft-07 from a sample with nested arrays, mixed values and optional properties. Generate and download it locally.
How to Infer JSON Schema from JSON Data
A property is required when it appears in every sampled object at that position. Empty arrays leave items unconstrained. Review the inferred rules against your contract.
JSON Schema Generator: how to use it
- Paste representative JSON or open a local UTF-8 file. Use an array to show several examples at the same position.
- Choose the schema draft and whether to infer string format hints.
- Generate the schema and review required properties, mixed types and empty arrays before you copy or download it.
Limits and notes
Runs on this device with up to 4,194,304 input and output characters, 4 MiB per file, 128 nested levels and 500,000 JSON tokens. Observations infer types, required fields and optional format hints. The generated schema permits new properties and leaves ranges, enum values, dependencies and tuple positions unspecified.
How your privacy works →JSON Schema Generator: common questions
How does it infer required properties from a sample array?
A property becomes required when present in every sampled object at that position. A property with a null value is present. Review the list against your actual API or file contract.
What happens when an array contains several kinds of values?
The tool observes every item. Distinct kinds use anyOf. Object samples share a property map. An array with no observed items produces an empty items schema.
Do format hints validate dates or addresses?
The checkbox infers hints only when sampled strings at a position agree. Whether a validator enforces format depends on its draft, vocabulary and settings.