JSON Schema Guide
JSON Schema describes the structure and constraints a JSON document is expected to follow. It can verify required fields, data types, nested objects, arrays, enums, patterns and numeric limits after the JSON itself is syntactically valid.
Quick answer
JSON syntax validation asks “is this valid JSON?” JSON Schema validation asks “does this valid JSON have the shape and values my application expects?”
What JSON Schema validates
A schema can require properties, restrict values to specific types or enums, validate array items, apply string patterns and length rules, set numeric minimums and maximums, and describe nested objects. This makes it useful at API boundaries, configuration loading, form processing, test fixtures and data pipelines.
Start with type and properties
For an object, the most common starting point is {"type":"object","properties":{...}}. Each property can have its own schema. Add a required array for fields that must exist and additionalProperties:false when unknown keys should be rejected.
Schema validation is not business validation
A schema can verify that age is an integer between 0 and 120, but it cannot know whether a particular age is permitted by your business workflow unless you encode that rule. Treat schema validation as a strong boundary check, not a replacement for application logic.
Basic JSON Schema example
{
"type": "object",
"required": ["id", "email"],
"properties": {
"id": { "type": "integer", "minimum": 1 },
"email": { "type": "string", "pattern": "^[^@]+@[^@]+$" },
"active": { "type": "boolean" }
},
"additionalProperties": false
}Related JSON tools and guides
Frequently asked questions
What is JSON Schema?
JSON Schema is a vocabulary for describing and validating the structure, types and allowed values in JSON data.
Is JSON Schema the same as JSON validation?
No. JSON validation checks syntax. JSON Schema validation checks whether already-valid JSON conforms to an expected structure and constraints.
Which JSON Schema draft should I use?
Use the draft supported by the systems that exchange your data. Modern tooling commonly targets newer drafts, but compatibility matters more than choosing a draft in isolation.