JSON Schema Validator

Paste a JSON Schema and a JSON document side by side. The validator lists every violation with the location in the document, the keyword that failed and the place in the schema that demands it.

Loading tool…

About the JSON Schema Validator

A JSON Schema describes what a JSON document must look like: which properties are required, what type each value has, which range a number must be in, which pattern a string must match. This tool checks a document against a schema and reports all violations at once instead of stopping at the first. Each error names the value by its JSON Pointer (for example /items/1/quantity) and its line in the document, the keyword that failed (required, type, minimum, enum…) and the path of that keyword in the schema, $ref steps included.

The draft is read from $schema; without one, 2020-12 is assumed, and you can force draft-04, draft-07, 2019-09 or 2020-12. The draft matters: exclusiveMinimum is a boolean in draft-04 and a number later, the array form of items became prefixItems in 2020-12, and unevaluatedProperties only exists since 2019-09. Raw validator output is noisy, so the list is tidied: a parent that only says that a child failed is dropped, the failed alternatives of anyOf and oneOf are grouped under one entry, and a property that fails its own schema is not reported a second time as an additional property.

The schema itself is checked for mistakes that validators silently accept: a misspelled keyword such as requried (unknown keywords are ignored by design, so the constraint never applies), a type that does not exist such as int, required: true on a property (the draft-03 form), or a pattern that is not a valid regular expression. Validation runs in your browser with the @cfworker/json-schema library. References to other files or URLs are not fetched; put shared definitions under $defs.

How to use it

  1. Paste the JSON Schema into the left editor and the document into the right one.
  2. Leave the draft on auto-detect, or pick the draft your application validates with.
  3. Read the verdict above the editors; syntax errors of either input are shown first.
  4. Go through the error table: location and line in the document, keyword, reason and schema path.
  5. Fix the document (or the schema) and watch the list update as you type.

Frequently asked questions

Which JSON Schema drafts are supported?
Draft-04, draft-07, 2019-09 and 2020-12. A schema that declares draft-06 is checked with the rules of draft-07, which accepts the same keywords. Without $schema the validator assumes 2020-12.
Why does my misspelled keyword not cause an error?
JSON Schema tells validators to ignore keywords they do not know, so that schemas can carry annotations. A typo such as minlength therefore simply never applies. This tool warns when an unknown keyword is very close to a real one.
Is the format keyword enforced?
Yes, here it is: format values such as email, date-time, uri, ipv4 or uuid are checked. The specification allows validators to treat format as an annotation only, so other validators may accept what this one rejects. Check how yours is configured.
Can I use $ref to another file or URL?
Not here. References inside the schema (#/$defs/address, #/definitions/address, anchors) are resolved; references to other documents are not downloaded, because the tool makes no network requests. Copy the referenced schema into $defs.

Related tools