Toolstia / JSON Schema generator
JSON Schema generator
Paste a sample JSON document and get a JSON Schema that describes it. Types are inferred for every field, arrays and nested objects are handled, and you can mark fields as required and detect formats such as dates and emails.
The schema is inferred from your one example, so review it. A number written as 1 becomes integer and 1.5 becomes number. When an array holds several objects their keys are merged, and a key is only required if every object has it.
How it works
- Paste a sample of your JSON.
- Choose the draft version and whether to mark properties as required.
- Copy the schema.
How types are inferred
Strings, numbers, integers, booleans, nulls, arrays and objects are recognised. Arrays of different shapes are merged into one description of the items.
Formats
With format detection on, strings that look like dates, date-times, emails, URLs or UUIDs get a matching format keyword.
Drafts
Draft-07 and 2020-12 are supported. They differ mainly in the $schema line.
A starting point
A schema made from one sample cannot know your real rules. Add minimum values, patterns and enums by hand where they matter.
Questions
Is my JSON uploaded?
No. Everything happens in your browser, and nothing you enter is sent anywhere.
Why are all fields required?
You asked for that with the required option. Untick it to leave fields optional.
Can it read very large files?
It works on whatever your browser can hold, but a small, typical sample gives the cleanest schema.