About JSON Schema Generator
Create a JSON Schema from example data. Paste a JSON document, or a list of several example documents, and the tool works out the types, which properties are always present, and common string formats such as dates and email addresses, then writes a schema you can use to validate data in your code, API or forms. It is a starting point built from your examples, so read it over and tighten it before you rely on it.
How to use JSON Schema Generator
- Paste your sample JSON, or press Sample to try two example people.
- Choose the Schema version your validator supports. 2020-12 is the newest.
- Tick or clear the options: required properties, extra properties, string formats, examples, and how the top-level array is treated.
- Read the schema and the property count, then press Copy or Download to save schema.json.
Tips and good to know
- With Top-level array = list of samples ticked, each item of a top-level array is treated as a separate example and merged into one schema that describes a single item. Clear it to describe the array itself.
- A property is marked required only if it appears in every example object. A property that is missing from some examples is left optional, and one that is sometimes null gets both types.
- Whole numbers are written as integer. JSON cannot tell 1 from 1.0, so choose number under Whole numbers if values such as 1 may also be 1.5.
- Detect string formats adds format for values that look like a date-time, date, time, email, UUID, IPv4 or IPv6 address, or URI, but only when every string seen in that place has the same format.
- Forbid extra properties adds additionalProperties: false, which makes validation reject any property you did not show in your examples.
- Draft 4 has no examples keyword, so none are added there, and the tool tells you.
Frequently asked questions
Is the schema complete and correct?
It describes the examples you gave, exactly. It cannot know things your examples do not show, such as a field that only allows certain values, a maximum length, or a property that is optional but present in every example. Treat it as a first draft.
Which schema version should I pick?
Use the version your validator or framework supports. 2020-12 is the newest, Draft 7 is very widely supported, and Draft 4 is for older tools. The schema line at the top shows which version was written.
Why are some properties missing from required?
Only properties found in every example object are listed. Add more example documents that show the optional cases, or edit the required list by hand.
Does it check my data against a schema?
No. This tool only creates a schema from data. To check data you need a JSON Schema validator in your own code or another tool.
Is my JSON uploaded?
No. Everything runs in your browser and nothing is sent or stored.
Is JSON Schema Generator free?
Yes. JSON Schema Generator is 100% free: no sign-up, no paid plan, no trial and no limit on how often you use it. It runs in your browser, and ToolzAura is paid for by ads, so every tool stays free.
Are my files uploaded?
No. This tool runs in your browser, so your input stays on your device.