JSON Schema Validator

Check a JSON document against a JSON Schema. Every rule it breaks is listed with the exact location in the data and the part of the schema that failed.

Updated
Runs in your browser. Your data is not uploaded.
Validates as you type. Powered by Ajv.

How to use the JSON Schema Validator

  1. Paste your schema into JSON Schema and the document to check into JSON data. Press Load sample to see both filled in.
  2. Pick the Draft. If the schema has a $schema field, use the draft it names.
  3. Press Validate. You get either a success message or a table of errors, each with the data path, the failed keyword, and a message.

How it works

Validation uses Ajv, the most widely used JSON Schema validator for JavaScript, loaded into your browser.

  • The schema is compiled first. A schema with an unknown keyword or a broken $ref is reported before any data is checked.
  • All errors are collected in one pass, so fixing them one by one isn't needed.
  • The data path is a JSON Pointer: /items/2/price means the price of the third item.
  • Formats such as email, date-time, uri, ipv4, and uuid are checked, not only annotated.

Examples

Schema:

{
  "type": "object",
  "required": ["id", "email"],
  "properties": {
    "id": { "type": "integer", "minimum": 1 },
    "email": { "type": "string", "format": "email" }
  },
  "additionalProperties": false
}
  • {"id": 7, "email": "[email protected]"} is valid.
  • {"id": 0, "email": "ada"} has two errors: /id must be >= 1, and /email must match format "email".
  • {"id": 7} fails with: must have required property 'email'.
  • {"id": 7, "email": "[email protected]", "admin": true} fails with: must NOT have additional properties (admin).

Limitations

  • Remote $ref URLs are not downloaded. Put every definition you need in the same schema, under $defs or definitions.
  • Drafts 2019-09, 04, and 06 are not offered. Most draft-06 schemas also validate under draft-07.
  • Schema and data are each limited to 5 MB.
  • OpenAPI files use their own dialect. Use the OpenAPI Validator for those.

Frequently asked questions

What is JSON Schema?

A JSON document that describes what other JSON must look like: which keys are required, what type each value has, allowed ranges, patterns, and more. APIs and config files use it to reject bad input early.

Which draft should I choose?

Use the draft named in the schema's $schema field. New schemas should use 2020-12. Many older tools and editors still use draft-07.

Why does valid-looking data fail on additionalProperties?

The schema sets additionalProperties: false, so any key not listed under properties is an error. Add the key to the schema or remove it from the data.

Is my data sent anywhere?

No. The schema and data are validated in your browser.

Often used together with the JSON Schema Validator.

  • JSON Validator

    Checks JSON syntax and explains any error in plain English.

  • JSON Viewer

    Shows JSON as a collapsible tree with search and copyable paths.

  • OpenAPI Validator

    Checks OpenAPI 3.x and Swagger 2.0 specs for structural errors and broken $refs.