Required keys
Keys present in every example are listed in required; others stay optional.
Infer a JSON Schema from example data for validation, documentation and OpenAPI.
Generate a JSON Schema (draft 2020-12) from example JSON: types, required keys, nested objects, array items and formats like date-time, uuid and uri.
{"id":7,"name":"aarav","tags":["a"]}{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "User",
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"tags": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"id",
"name",
"tags"
]
}Tip: Add descriptions, enums and minimum/maximum values by hand afterwards; examples cannot reveal those rules.
Keys present in every example are listed in required; others stay optional.
date-time, date, uuid and uri formats are detected from string values.
Whole numbers become integer; decimals become number.
Optionally add additionalProperties: false to reject unknown keys.
JSON Schema draft 2020-12, the version used by OpenAPI 3.1. Most validators, such as Ajv, support it.
items holds one schema merged from all elements, so optional item fields are detected.
Values that are sometimes null get a type list such as ["string", "null"].
Yes, the schema is generated in your browser.