JSON Validator

Check JSON data against a JSON Schema (draft-07 or 2020-12) and see every error with its path.

About the JSON Validator

Paste JSON data and a JSON Schema to check whether the data matches the schema. Every problem is listed with the path where it occurs, such as “/age must be integer”.

Everything you enter is processed in your browser; nothing is uploaded or stored.

How to use it

  1. Paste the JSON data on the left (an example is filled in).
  2. Paste the JSON Schema on the right.
  3. Press Validate and fix each listed problem, then validate again.

How JSON Schema validation works

A JSON Schema describes what valid data looks like: the type of each value, which properties are required, allowed ranges and lengths, patterns and whether extra properties are allowed. The validator (Ajv, a widely used open-source library) checks the data against every rule and reports all failures at once.

Draft-07 is used by default; if your schema declares "$schema": "https://json-schema.org/draft/2020-12/schema", the 2020-12 rules are used. The "format" keyword (for example "email") is not checked here.

Example

With the schema filled in, changing "age": 21 to "age": "21" gives “/age must be integer”; adding "city": "Pune" gives “(root) must NOT have additional properties: "city"”.

Common mistakes

  • Writing "required": true inside a property (old draft-03 style); in current drafts "required" is an array on the parent object.
  • Forgetting "additionalProperties": false when extra keys should be rejected.
  • Confusing "number" (any number) with "integer" (whole numbers only).
  • Pasting invalid JSON: check syntax first with JSON Lint, then validate against the schema.

Frequently asked questions

What is the difference between JSON Lint and JSON Schema validation?

JSON Lint checks that the text is valid JSON. Schema validation checks that valid JSON has the right structure and values.

Which JSON Schema versions are supported?

Draft-07 by default and 2020-12 when the schema declares it.

How do I create a schema from my data?

Use the JSON Schema Generator to draft one from a sample, then tighten the rules.