Paste a JSON Schema and a JSON document and validate the document against it — every violation is reported with its exact path and the rule it broke.
The instance is checked against every applicable keyword in your schema, recursively through nested objects and arrays: type, required, properties, additionalProperties, items, enum, const, pattern, numeric bounds (minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf), string bounds (minLength, maxLength), array bounds (minItems, maxItems, uniqueItems), object bounds (minProperties, maxProperties), format, and composition keywords (allOf, anyOf, oneOf, not). Each failure is reported with the path where it occurred, written with dots for keys and brackets for array indexes, such as items[2].sku.
The starter schema requires a non-negative integer age and at least one role, while the instance has "age": -1 and an empty roles array. The result is two rows:
error age value below minimum 0
error roles array shorter than minItems 1email is not reported because it is optional: it is listed in properties but not in required.
Schema:
{
"type": "object",
"required": ["id", "items"],
"properties": {
"id": { "type": "string", "pattern": "^ord_[0-9]+$" },
"status": { "enum": ["paid", "pending", "refunded"] },
"items": {
"type": "array",
"items": {
"type": "object",
"required": ["sku", "qty"],
"properties": {
"sku": { "type": "string" },
"qty": { "type": "integer", "minimum": 1 }
}
}
}
}
}Instance:
{
"id": "ORD-17",
"status": "shipped",
"items": [
{ "sku": "A1", "qty": 2 },
{ "sku": "B2", "qty": 0 },
{ "qty": 1 }
]
}Errors:
error id does not match pattern ^ord_[0-9]+$
error status value must be one of ["paid","pending","refunded"]
error items[1].qty value below minimum 1
error items[2].sku required property missingEvery violation is listed, not just the first, so you can fix the whole payload in one pass. Patterns are not anchored automatically, which is why ^ and $ appear in the regular expression.
Validating { "email": "ada.example.com", "age": "37" } against a schema with "format": "email" on email and "type": "integer" on age gives:
error email does not match format "email"
error age expected type "integer", got "string"When a value has the wrong type, the remaining checks for that value are skipped, so fix the type first and validate again.
This is a lightweight validator for the keywords listed above. $ref, definitions/$defs, if/then/else, patternProperties, dependencies, propertyNames, contains and tuple-style items arrays are ignored rather than rejected, so a schema that relies on them can report "Valid" too easily. A number such as 2.0 counts as an integer, as the specification allows. For anyOf and oneOf you get one summary line (for example "matched 2 schemas in oneOf, expected exactly 1") rather than the reasons each branch failed.
Do not have a schema yet? Generate a first draft from a sample payload with the JSON Schema generator. If the instance will not parse at all, the JSON validator shows the exact line and column of the syntax error. Test a tricky pattern in the regex tester before putting it in a schema.
The core Draft-07 validation keywords: type, required, properties, additionalProperties, items, enum, const, pattern, minimum/maximum, exclusiveMinimum/exclusiveMaximum, multipleOf, minLength/maxLength, minItems/maxItems, uniqueItems, minProperties/maxProperties, format, and allOf/anyOf/oneOf/not. The $schema value is not read, so the same keywords are applied whichever draft you declare.
No. $ref, definitions and $defs are not resolved, and any keyword the validator does not know is ignored. Inline referenced subschemas before validating here, or use a full validator such as Ajv for schemas built from references.
Each row shows the location of the failing value and the rule it broke. Paths use dots for keys and brackets for array indexes, so items[1].qty with "value below minimum 1" means the qty of the second item is less than the schema minimum. (root) means the whole document.
Usually one of three reasons: the keyword is not supported (for example if/then or patternProperties), the property is listed in properties but not in required so its absence is allowed, or the format name is one the validator does not check.
email, uri, uuid, date and date-time, using simple pattern checks. Other format names are accepted without checking.
No. Validation runs entirely in your browser with JavaScript; nothing is sent to a server.
Learn how schemas validate types and required fields in the JSON Schema Validator Guide.