About the JSON Schema Generator
Creating a JSON Schema to validate API responses or user input is a time-consuming and error-prone process. You need to remember all the schema syntax rules, spend hours defining individual data types, and make sure that your nested objects and arrays match the required structure.
With this JSON Schema Generator, you can automatically generate a schema from any sample JSON document with a few simple clicks. The created schema will instantly recognize all the data types and nested structures in your input data. The comparison runs in your browser, which matters when the data is sensitive.
Key Features of JSON Schema Generator
- Quick starting pointYou don't have to write every validation rule by hand. This tool can automatically analyze any sample JSON document and accurately determine all the data types.
- Draft 2020-12 complianceThe generated schema will always be valid according to the JSON Schema specification draft 2020-12, so it will perfectly validate your data.
- Customizable propertiesYou can easily customize your schema by adding a descriptive title and selecting which properties should be required.
- 100% local processingAll schema generation operations take place locally in your browser. Your privacy is guaranteed since no data is ever sent to external servers.
- Instant file exportYou can also immediately export your schema to a file once it is created. Or simply copy the generated JSON Schema to your clipboard.
How to Use JSON Schema Generator
- To use the JSON Schema generator, simply enter your sample JSON document, add a title to your schema, select which properties should be required, and click the "Generate schema" button. Then, you can use the "Copy" or "Download" buttons to save your schema.
JSON Schema Generator Examples
A starting schema inferred from one sample. Every key seen is marked as required, so relax that if some are optional.
{"id":7,"email":"[email protected]"}{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Generated Schema",
"type": "object",
"properties": {
"id": {
"type": "number"
},
"email": {
"type": "string",
"format": "email"
}
},
"required": [
"id",
"email"
]
}