What is JSON Schema Validator?
This JSON schema validator checks JSON data against a JSON Schema and lists every rule the data breaks. Paste your data on one side and the schema on the other: the validator walks the whole document, nested objects and arrays included, and reports each error with the JSON path of the failing value, such as /items/2/price, and the schema keyword that failed.
It supports the keywords used in real API contracts and configuration schemas, from type, required and enum to pattern, format, numeric and length limits, additionalProperties, $ref and the combinators allOf, anyOf, oneOf and not. That gives a fast, readable answer to "does this payload match the contract?" while you design an API, write tests or debug a request that a backend rejects.
How to use JSON Schema Validator
- Paste the JSON data you want to check into the JSON Data box.
- Paste the JSON Schema into the JSON Schema box, or load the valid or invalid example to see how it works.
- Read the result: a green message means the data matches; otherwise every error is listed with the path of the failing value.
- Fix each listed problem, such as a missing required property, a wrong type or a value outside the allowed range.
Key features
- Supports Draft 4, 6, 7, 2019-09 and 2020-12 schemas
- Every error with the JSON path of the failing value and the schema keyword
- $ref, $defs, definitions, $id and $anchor resolution within the schema
- Format checks for email, date-time, uuid, uri, hostname, IPv4 and IPv6
- allOf, anyOf, oneOf, not and if/then/else combinators
- Runs in your browser; data and schemas stay private
Common use cases
- Checking API request bodies against their contract during development
- Verifying that responses include every required field
- Catching type mismatches such as a numeric ID sent as a string
- Prototyping a JSON Schema before adding full validation in code
- Reviewing fixtures and test data
Technical details & standards
The validator implements the assertion keywords of JSON Schema Draft 4, 6, 7, 2019-09 and 2020-12: type (including integer and null, and lists of types), enum and const; minimum, maximum, exclusiveMinimum, exclusiveMaximum and multipleOf; minLength, maxLength, pattern and format; items, prefixItems, additionalItems, contains, minItems, maxItems and uniqueItems; properties, required, additionalProperties, patternProperties, propertyNames, minProperties, maxProperties, dependencies, dependentRequired and dependentSchemas; and allOf, anyOf, oneOf, not and if/then/else. $ref resolves within the schema through JSON pointers (#/definitions/... and #/$defs/...), $id and $anchor.
Formats such as email, date-time, date, time, uuid, uri, hostname, ipv4 and ipv6 are checked as assertions, as Ajv does with ajv-formats. Results match the official JSON-Schema-Test-Suite for the supported keywords, apart from a few edge cases around internationalized host names and draft-specific $ref rules. Not supported: references to other documents (remote $ref), unevaluatedProperties, unevaluatedItems and $dynamicRef; if a schema uses them, the result says they were not checked.
Frequently asked questions
What is JSON Schema?
JSON Schema is a vocabulary for describing the structure of JSON data: which properties exist, which are required, their types and constraints. It is used for API contracts (including OpenAPI), configuration validation and form generation.
Which JSON Schema keywords does this validator check?
All the assertion keywords: type, enum, const, numeric and string limits, pattern, format, array and object rules, the combinators allOf, anyOf, oneOf, not and if/then/else, and $ref within the schema. Remote $ref, unevaluatedProperties, unevaluatedItems and $dynamicRef are not supported.
Which JSON Schema draft should I use?
Use Draft 2020-12 for new schemas unless your tooling needs an older one; OpenAPI 3.1 uses 2020-12, while OpenAPI 3.0 and many existing projects use Draft 4 or Draft 7. The validator accepts all of them, including draft-specific forms such as the items array of Draft 7 and prefixItems in 2020-12.
How do I validate against a JSON Schema in code?
Use a validator library: Ajv for JavaScript and TypeScript, jsonschema or fastjsonschema for Python, networknt json-schema-validator for Java, or gojsonschema for Go.
What is the difference between JSON validation and JSON Schema validation?
JSON validation checks syntax, whether the text is valid JSON at all. JSON Schema validation checks that valid JSON has the expected structure and types. Use the JSON Validator first, then this tool.
Is my data safe?
Processing happens locally in your browser. Tool input is not sent to CodeUnpack servers.
Does it work offline?
Once the page has loaded, this tool can process input without an internet connection.