JSON Schema Validator
Paste a JSON Schema and the JSON you want to check. The validator reports whether the data is valid and, if not, lists every error with where it is in your data, which schema keyword failed and why. The draft is detected from $schema, or you can pick one. Validation happens in this page: your schema and data are never uploaded.
The validator library (about 23 KB) is loaded from this site the first time you validate. Your schema and data stay in this page.
How to use
- Paste your JSON Schema into the left box and the JSON data into the right box, or click Load sample (valid) or Load sample (invalid).
- Leave Draft on Auto-detect to use the version named in the schema's $schema keyword, or choose 2020-12, 2019-09, 07 or 04 yourself.
- Click Validate (or press Ctrl+Enter). The first time, the validator library (about 23 KB) is loaded from this site.
- Read the result: ✓ Valid, or a list of errors, each with the path in your data (as $.a.b[0] and as a JSON Pointer), the failing keyword, the schema path and a message.
- Tick Show summary errors to also see the parent errors (such as "Property x does not match schema") that lead to each problem, then copy or download the errors.
Examples
{
"type": "object",
"required": ["id", "qty"],
"properties": {
"id": { "type": "string", "pattern": "^ORD-[0-9]{4}$" },
"qty": { "type": "integer", "minimum": 1 }
},
"additionalProperties": false
}{ "id": "1042", "qty": 0, "gift": true }$.id (/id) String does not match pattern. [pattern] $.qty (/qty) 0 is less than 1. [minimum] $ (/) Property "gift" is not allowed (additionalProperties is false). [additionalProperties]
Supported formats
- Schemas written for JSON Schema Draft 2020-12, Draft 2019-09, Draft-07 and Draft-04 (Draft-06 schemas are checked with Draft-07 rules). Both the schema and the data must be strict JSON.
- $ref to anything defined in the same schema: "#/$defs/…", "#/definitions/…", JSON Pointers, $anchor and embedded $id values. Recursive references work.
- Errors can be copied as text or downloaded as JSON with instance location, keyword, schema location and message for each.
Privacy
This tool runs entirely in your browser. Nothing you enter or open is sent anywhere. Privacy policy.
Limitations
- Remote $ref values (such as https://example.com/address.json) are never downloaded. The tool says which reference is missing; copy that schema into $defs and point the $ref at "#/$defs/name".
- The "format" keyword is always enforced, in every draft, for date, time, date-time, duration, email, hostname, ipv4, ipv6, uri, uri-reference, uri-template, url, uuid, regex, json-pointer and relative-json-pointer. Other formats (such as idn-email or iri) are ignored. Strictly, Drafts 2019-09 and 2020-12 treat format as an annotation unless asked, so another validator may accept values this one rejects.
- $dynamicRef and $dynamicAnchor (Draft 2020-12) are not supported; the tool warns when a schema uses them. The schema itself is not checked against its meta-schema, so misspelt keywords are silently ignored.
- Very large documents (many megabytes, or tens of thousands of errors) can take a few seconds; at most 500 errors are listed on screen, while Copy and Download include all of them.
- Numbers are read by JavaScript, so integers beyond 2^53 lose precision, and when a key appears twice in an object only the last value is checked.
FAQ
Which JSON Schema draft should I choose?
Leave it on Auto-detect: the tool reads the $schema URI at the top of the schema. If there is none, Draft 2020-12 rules are used. Choose a draft yourself only when a schema omits $schema but was written for an older draft, for example one that uses "definitions" and a boolean exclusiveMaximum (Draft-04).
Why does my $ref fail with "isn't defined inside it"?
The reference points to a schema that isn't part of what you pasted, usually a URL to another file. Nothing is fetched from the internet, so paste the referenced schema under "$defs" and change the $ref to "#/$defs/<name>".
What are summary errors?
When a nested value fails, the validator also reports each parent keyword on the way, for example "Property customer does not match schema" above the real problem inside customer. They are hidden by default so the list shows only the errors you need to fix.
Is my JSON sent to a server?
No. The schema and data are validated by JavaScript in this page. The only download is the validator library itself, served from this site the first time you click Validate; your text is never sent anywhere.