Data Formats

JSON Schema Validator

Validate a document against a JSON Schema and read every error with its instance path.

  • History kept on this deviceRecent results are kept in this browser's local storage until you clear them.
  • Runs in your browserProcessing happens in this page. No application server receives your input.

Document

Schema

Validation

Validation results appear here.

What this tool does

Validate checks a JSON document against a JSON Schema and lists every error, each with the path of the value in the document, the keyword that failed and the validator's message. For example, {"price":-1} against {"properties":{"price":{"minimum":0}}} lists one row: /price, /properties/price/minimum and -1 is less than 0.

What it does not do

It does not run as you type, take a second schema field or a pasted-in registry of referenced schemas, offer a download, highlight the failing node, bundle a meta-schema or repair a document. Nothing you paste is sent anywhere.

References

A reference to another schema document, such as $ref with a URL, is reported with the workaround, even when no part of the document uses it, and nothing is ever fetched. Paste the referenced schema inline under $defs and refer to it there. A $dynamicRef is not evaluated, and a warning says so.

Dialects

Drafts 4, 7, 2019-09 and 2020-12 are read, taken from $schema. A schema without one, or with one this validator does not know, is read as 2020-12, and an unknown one adds a warning. A subschema's $schema is not applied, and a warning says so. A dialect changes how the sibling keywords of a $ref read, and how exclusiveMinimum and exclusiveMaximum read, and nothing else, so a keyword its draft does not define, such as prefixItems under draft-07, is still read.

What is refused

A schema is refused, with the keyword named, when it holds a keyword of the wrong type, a value the validator cannot read, a format named after a built-in JavaScript property, an invalid pattern, a reference that leads back to itself without reading further into the document, or a const string longer than 1,024 characters, which you can check with pattern or enum instead.

Reading results

  • Patterns run in Unicode mode.
  • A known format is asserted under every draft, by this validator's own patterns, which can differ from the format's definition: time needs no offset, date-time takes a space, and url refuses localhost and private addresses. An unknown one passes.
  • The rows of an anyOf or a oneOf list alternatives, not all of which must hold.
  • A repeated key keeps its last value, and a warning appears.
  • Numbers beyond 2^53 lose precision, and 1e400 reads as infinity. multipleOf allows about 1.2e-7, so a smaller one reads every number as a multiple, and a negative number can read as not a multiple where its positive form is one, as -1 does for 0.1.
  • unevaluatedProperties and unevaluatedItems can read too loosely beside an if or inside another applicator, and a warning says so.
  • A property that fails properties can have a second row from additionalProperties.
  • contains beside maxContains can report /minContains, which the schema does not hold.
  • A Message cell holds the interpreter's words, which can misstate a keyword: Instance does not have at least 1 properties. is how it reports maxProperties, and 5 is less than 5. how it reports exclusiveMinimum, so read the Keyword cell.
  • WebKit's regular expression engine gives up on a catastrophic pattern and reads it as no match, where other engines run on to the time limit.

Limits

Up to 1.0 MB each. A reference to another schema is reported with a workaround and never fetched. The dialect comes from $schema, and 2020-12 is used without one. A run stops after 30 seconds.

LimitValueWhat happens
Document size1.0 MBLarger is refused, and nothing is run.
Schema size1.0 MBLarger is refused, and nothing is run.
Nesting, each side64 levelsDeeper is refused, with the position of the opener.
Member names, each side200,000More is refused.
Errors listed256The first are listed, and the sentence gives the true count.
Text per field of an error2,048 charactersCut and marked.
Text per cell500 charactersCut with an ellipsis. Copy holds the cell text the table shows, so the two agree.
An enum or const in a message1,024 charactersA longer one is shown as a fixed phrase, and the comparison still uses the real value.
The validator's lookup of a schema64.0 MB of textNested $id keywords and long keys that need more are refused.
Weighted failures in one run2,000,000Past it the run has no verdict.
Repeated-key warnings, each side1,000The rest are counted, not listed.
Time30 secondsThe run stops, and the next press starts a new one.

A table cell shows at most 500 characters of any text.

Time and the missing verdict

A run stops after 30 seconds, and a valid document that is slow to check stops there too. Cancel stops a run you started. Sometimes a run has no verdict: β€œThis validation needed more room than the validator has”. It happens with a long list of failures under a wrapping keyword, a long chain of references, a long list of alternatives that pass over an object or an array, a pattern too large to compile, and the failure ceiling. A long key, an echoed value or a long type list under many failures reaches the ceiling sooner. A valid document can reach it too, because what an anyOf discards, what each alternative evaluates and a very long allOf over many items all count.

Storage

The two fields and up to the last runs are kept in this browser's storage, and nothing leaves it. The storage holds 131,072 characters in all, so fields over that still validate and are not kept after a reload. If storage is unavailable or full, every run still completes.

Scope: this covers the page itself. Your browser, operating system, clipboard, downloads, extensions, and crash recovery may keep copies, and a compromised site origin would not be protected.