JSON Schema Validator
Free JSON Schema validator: check JSON against draft-07, 2019-09 or 2020-12 schemas and list every error with its path, message and keyword. Runs in your browser.
How to use JSON Schema Validator
- 1Paste the JSON data in the first box and the JSON Schema in the second, or press Try example.
- 2Leave the draft on Automatic, or pick draft-07, 2019-09 or 2020-12.
- 3Read the list of errors, or the green Valid message, and fix the data or the schema.
What makes it better
- Supports draft-07, 2019-09 and 2020-12 with the draft picked from $schema
- All errors listed at once, each with path, message and failing keyword
- Standard formats such as email, date-time and uri are checked
- Line and column for invalid JSON in either box, and clear messages for invalid schemas
- Never fetches remote $ref targets, so nothing leaves your device
About JSON Schema Validator
JSON Schema Validator checks a JSON document against a schema using the Ajv library with the standard string formats such as email, date and uri. It reports every problem rather than stopping at the first, each with the path of the failing value, a message and the schema keyword that failed. The schema must be self-contained, because remote references are never downloaded.
Common uses
- Check an API request or response against its published schema before shipping.
- Debug why a configuration file is rejected by a tool that uses a schema.
- Write a schema and test it against valid and invalid samples.
- Explain to a colleague exactly which field breaks a contract.
Example
Input
{"name":"A","age":-3,"email":"not-an-email","tags":["x",5]}
=====
{"type":"object","required":["name","age","id"],"properties":{"name":{"type":"string","minLength":2},"age":{"type":"integer","minimum":0},"email":{"type":"string","format":"email"},"tags":{"type":"array","items":{"type":"string"}}}}Result
$: must have required property 'id' (required) $.name: must NOT have fewer than 2 characters (minLength) $.age: must be >= 0 (minimum) $.email: must match format "email" (format) $.tags[1]: must be string (type)
Good to know
- References must be inside the schema, for example "#/$defs/address". A $ref to another URL is not loaded and is reported as unresolved; paste that schema into $defs instead.
- Strict schema mode is off, so unknown keywords are ignored rather than rejected. Draft-04 schemas are not supported.
- At most 500 errors are listed, and the total is shown. Formats follow the Ajv formats library, which may be stricter or looser than another validator.
JSON Schema Validator FAQ
How do I validate JSON against a schema?
Paste the data in the first box and the schema in the second. The result updates as you type: either a green Valid message, or a list of every place the data breaks the schema.
Which JSON Schema versions work?
Draft-07, 2019-09 and 2020-12. On Automatic the draft comes from the $schema line, and with no $schema line draft-07 is used. Pick a draft by hand to override it.
What does an error line mean?
The path shows which value failed, for example $.tags[1], the message explains why, and the keyword badge such as type, required or minimum names the schema rule that was broken, so you can find it in the schema.
Why is my $ref reported as unresolved?
A reference must point to something inside the same schema. Pointers like #/$defs/name work, but URLs are never fetched, so move the referenced schema under $defs and point to it there.
Does it validate formats such as email and date-time?
Yes. The standard formats from Ajv's formats library are checked, including email, date, time, date-time, uri, uuid and ipv4. A value that does not fit is reported with the format keyword.