JSON Schema validator

Runs in your browser; nothing is uploaded

Check a JSON document against a JSON Schema (drafts 4 to 2020-12) and see every error with its path and the rule it breaks. $refs inside the schema are followed. Nothing is sent.

Schema

JSON

Result

Nothing yet

Paste a schema on the top left and JSON below it, or pick an example.
Ready
Ln 1, Col 1

Checking JSON against a schema

A JSON Schema is a contract: it says which properties a document must have, their types, and the values they may take. Validating checks a document against that contract and lists every place it breaks it.

Each error here has a path to the value, such as $.orders[2].total, the schema keyword that failed, such as required, type or enum, and a sentence saying what was expected and what was found. When a value has the wrong type, the other rules for that value are skipped, so one mistake gives one error.

$ref is followed to any definition in the same schema, under $defs, definitions or any JSON pointer. oneOf reports whether the value matched none or more than one of the shapes, and anyOf shows the closest one's first problem.

How to use this tool

  1. 1Paste the schema in the top editor and the JSON to check below it, or pick an example.
  2. 2Read the result: Valid, or each error with its path and rule.
  3. 3Fix the JSON (or the schema), and the result updates as you type.
  4. 4Copy the error list to paste it into a bug report.

Troubleshooting

Schema: a JSON Schema is an object
The schema must be a JSON object such as {"type": "object"}, or true or false.
A note says a $ref points outside this document
References to other files or URLs aren't fetched. Paste the referenced definitions into $defs and point the $ref at #/$defs/….

Frequently asked questions

Is my JSON uploaded?

No. Schemas are generated and checked in your browser.

Which drafts are supported?

Draft 4, 6, 7, 2019-09 and 2020-12, including $ref, $defs and definitions, allOf, anyOf, oneOf, not and if/then/else. A $ref to another file isn't fetched; it's reported so you know that part wasn't checked.

Can I check API responses against a schema on every run?

Yes: API tests on testingapis.com check each response against its schema and alert you when one stops matching.