Learn · Guide
JSON Schema in Five Minutes
The smallest useful subset: type, properties, required, and what validation actually proves.
A schema is a description
JSON Schema is a document that describes another JSON document. It says which keys are allowed, what type each value should be, and which keys must be present. A validator reads both and tells you whether the data matches the description. Nothing more: it does not repair the data or guess what you meant.
The three keywords you need first
type sets the top-level shape: object, array, string, number, boolean or null. properties lists the expected keys and a small schema for each one. required lists the keys that must exist; keys not listed there are optional. That is enough to express most configuration files and API payloads.
{
"type": "object",
"properties": { "name": { "type": "string" }, "age": { "type": "number" } },
"required": ["name"]
}
Validation is not documentation
A passing validation means the data fits the shape you wrote. It does not mean the values are true, current, or appropriate. age: -3 is a number and will pass the schema above. Add minimum: 0 when that matters. Treat a schema as a contract about structure, not a guarantee about reality.
Try it locally
Paste the example above into the JSON Schema validator, then try {"name":"Ada"} and {"age":30} in turn. The first passes because age is optional; the second fails because name is required. Change required and watch the result flip.
Where schemas fit in a project
Teams usually use a schema in two places. At the edge of an application, it checks incoming JSON before the rest of the code trusts it. In a repository, it documents the shape of a config file so editors can offer completion and inline warnings. Both jobs benefit from the same document, but they solve different problems. A schema at the edge rejects bad input early; a schema in the repository reduces the number of bad files people write in the first place. Start small with type, properties and required, then add constraints only where a real mistake has happened. A schema that tries to describe every business rule becomes hard to read and easy to ignore, which is worse than a short one people actually check.