JSON Schema Validator
Validate JSON documents against a JSON Schema with detailed error paths
About JSON Schema Validator
JSON Schema validation checks that a JSON document conforms to a schema — verifying required fields, data types, value ranges, string patterns, and more. This is essential for validating API request and response bodies, configuration files, and any structured data where you need guarantees about the shape and content of the data.
- ✓Validates against JSON Schema drafts 4, 6, 7, 2019-09, and 2020-12
- ✓Detailed error messages with exact JSON paths to the failing values
- ✓Validates required fields, types, enums, patterns, minimums, maximums, and more
- ✓Useful for testing API contracts and data pipeline schemas
JSON Schema Validation in Practice
A JSON document can be perfectly valid JSON — correct brackets, quotes, and commas — while still being completely wrong for your application: a missing "email" field, a price sent as a string instead of a number, or a status value that isn't one of the three your code expects. JSON Schema validation catches exactly these problems by checking data against a contract, not just against the JSON grammar.
Anatomy of a schema
{
"type": "object",
"required": ["id", "email"],
"properties": {
"id": { "type": "integer" },
"email": { "type": "string", "format": "email" },
"role": { "type": "string", "enum": ["admin", "editor", "viewer"] },
"age": { "type": "integer", "minimum": 0 }
},
"additionalProperties": false
}This schema says: the document must be an object, it must include "id" and "email", "id" must be an integer, "email" must be a string formatted like an email address, "role" (if present) must be one of three exact values, "age" (if present) cannot be negative, and no properties other than the ones listed are allowed.
Reading a validation error
A typical error reports three things: the JSON path to the value that failed, the schema rule (keyword) it violated, and a human-readable message. For example, an error at path `/age` with keyword `minimum` and message "must be >= 0" tells you the "age" field in your document is negative — go to that path in your data and fix the value.
- ·`required` — a property listed as required is missing entirely from the object
- ·`type` — a value's type doesn't match (e.g. a string where a number was expected)
- ·`enum` — a value isn't one of the explicitly allowed options
- ·`pattern` — a string doesn't match the required regular expression (e.g. an invalid date format)
- ·`additionalProperties` — the object contains a key the schema doesn't allow
- ·`minimum` / `maximum` — a number falls outside the allowed range
Choosing a draft version
- ·Draft-07 — the most widely supported across libraries and tooling; a safe default if you're unsure
- ·Draft 2019-09 and 2020-12 — add features like `unevaluatedProperties` and improvements to `$ref` resolution, but support is less universal
- ·Most real-world differences between drafts won't affect a typical schema with `type`, `required`, `properties`, and `enum` — those keywords have worked the same way since draft-04
Tip: Don't write a schema by hand from scratch. Run a representative sample of your actual data through the JSON Type Generator tool to get a starting schema, then tighten it — add `required`, narrow `enum` values, and set `additionalProperties: false` once you're confident you know every field that can appear.
Where schema validation fits in a workflow
- ·Validating API request bodies before processing them, so malformed requests fail fast with a clear error instead of causing confusing downstream bugs
- ·Checking configuration files in CI before deployment, catching typos in keys or wrong value types before they reach production
- ·Verifying that a third-party API's response still matches the contract you originally integrated against, as an early warning for breaking changes
- ·Generating documentation — many tools can render a JSON Schema as human-readable API documentation