draft-07 · 2019-09 · 2020-12

JSON Schema validator

Compile a JSON Schema and validate a document against it, with every failure named by path and keyword.

0 characters

0 characters

Both documents are read in this tab. API payloads often contain identifiers, so nothing is uploaded.

Short answer: paste the schema and the document. Green means it matches; otherwise each row is a JSON Pointer, the keyword that rejected it, and what that keyword said.

Why the schema is compiled first

A schema can be syntactically valid JSON and still be an invalid schema — a typo like"type": "strng" compiles to a rule that can never match, and some mistakes throw outright. Compiling first separates “the contract is broken” from “the document is broken”, which are different fixes.

Reading a failure

The schema itself is often written in YAML — theYAML converter turns it into JSON for this page.

Schema questions

Which schema drafts are supported?

Draft-04, draft-07, 2019-09 and 2020-12. The draft is read from the schema’s $schema field, so prefixItems and unevaluatedProperties behave the way that draft defines them. A draft outside that set — draft-03, for instance — is refused rather than validated under newer rules, because the answer would be confidently wrong.

What is a JSON Pointer?

A path into the document, like #/items/2/price. It is the same notation ajv, OpenAPI tooling and JSON Patch use, so a failure here can be pasted straight into an issue or a test assertion.

Does a valid result mean my API will accept the payload?

It means the payload matches this schema. Whether the real service uses this schema, a different version of it, or additional server-side rules is a separate question — the schema is the contract only if that is the one the service enforces.

Why is an invalid schema an error, not a failed validation?

Because they are different problems. A schema that does not compile can never validate anything, and reporting it as “the document is invalid” would send you looking in the wrong place. The page compiles first and reports the schema error on its own.

Related tools