FormatterHQ

JSON Schema Validator

Paste a JSON document on the left and a JSON Schema on the right to check one against the other. Every violation is listed with its path, the rule that failed and the offending value.

Loading tool…
Ready.

How to use the JSON Schema Validator

  1. Paste the JSON you want to check into the JSON data editor on the left.
  2. Paste your schema into the JSON Schema editor on the right. Add a $schema URL to pick the draft.
  3. Leave Report all errors on to see every problem, or turn it off to stop at the first one.
  4. Click Validate (or keep Auto update on) and read the result, then fix the data or the schema and run it again.

Validate JSON data with a JSON Schema validator

This JSON Schema validator checks a JSON document against a schema and tells you exactly where the two disagree. It runs the Ajv engine with the ajv-formats plugin, so keywords such as required, enum, minItems, uniqueItems and additionalProperties are enforced, and string formats like email, date, uri and uuid are actually checked rather than ignored.

Use it while designing an API contract, when a request body is rejected and you want to know why, or to confirm that a config file matches the schema your application expects.

What is JSON Schema?

JSON Schema is a JSON vocabulary that describes the shape of other JSON: which properties exist, their types, which are mandatory, and what values are allowed. A schema is itself a JSON document, which is why this page has two editors: one for the data and one for the rules.

Schemas are used by OpenAPI, editor autocompletion (VS Code reads a $schema key), form generators and test suites. Validation is the step that turns the description into a pass or fail result.

Example

Here the schema requires an integer id, a valid email, a name and unique tags. The data breaks all four rules:

{"id": "42", "email": "jane@example", "tags": ["a", "a"]}

With Report all errors on, the result reads:

✘ 4 validation errors (2020-12):

1. (root)  must have required property 'name'
   line ~1 · rule #/required
2. /id  must be integer
   line ~1 · rule #/properties/id/type · value "42"
3. /email  must match format "email"
   line ~1 · rule #/properties/email/format · value "jane@example"
4. /tags  must NOT have duplicate items (items ## 0 and 1 are identical)
   line ~1 · rule #/properties/tags/uniqueItems

Each entry gives the instance path (where in your data), an approximate line number, the schema path of the rule that failed, and the rejected value for scalars. When everything passes you get a single line confirming the document is valid and naming the draft used.

Draft detection and options

  • Draft selection: the validator reads your schema's $schema URL. A URL containing 2020-12 uses the 2020-12 dialect, 2019-09 uses 2019-09, and anything else (including no $schema) is validated as draft-07. Draft-06 schemas work under draft-07; draft-04 schemas are validated with draft-07 rules, which matters mainly for the old boolean form of exclusiveMinimum.
  • Report all errors: on by default. Turn it off to get only the first failure, which is how many production validators behave.
  • Relaxed strict mode: unknown keywords such as example or custom x- annotations are ignored instead of rejected, so OpenAPI-flavored schemas still compile.

Common errors and fixes

  • "The schema itself is invalid" means the schema breaks the meta-schema, for example "type": "text" or "required": "id" instead of an array. Fix the schema before looking at the data.
  • must NOT have additional properties appears when additionalProperties is false and your data has a key the schema does not list. The message names the extra key.
  • A string number fails "type": "integer". "42" and 42 are different types in JSON Schema; nothing is coerced.
  • Dates like 1990-02-30 fail format: date because ajv-formats checks that the day exists, not just the pattern.
  • Remote $ref URLs are not downloaded. Keep referenced definitions inside the same schema under $defs or definitions.

Related tools

If you do not have a schema yet, generate a first draft from a sample document with JSON to JSON Schema, then tighten it here. To see what data your schema accepts, create realistic samples with the JSON Schema faker. For plain syntax checking without a schema, use the JSON validator.

Privacy

Validation runs entirely in your browser. Neither your data nor your schema is uploaded, so you can safely check payloads that contain customer records or internal API contracts.

JSON Schema validator in Python

Python has no JSON Schema support in the standard library; the jsonschema package is the usual choice. jsonschema.validate() raises on the first problem only, so to list every error, create a validator for your draft and loop over iter_errors(). Also note that format keywords such as email and date are not enforced unless you pass format_checker=FormatChecker() to the validator.

# pip install jsonschema
from jsonschema import Draft202012Validator

schema = {
    "type": "object",
    "required": ["id", "name"],
    "properties": {
        "id": {"type": "integer"},
        "tags": {"type": "array", "uniqueItems": True},
    },
}
data = {"id": "42", "tags": ["a", "a"]}

validator = Draft202012Validator(schema)
errors = list(validator.iter_errors(data))
for error in errors:
    print(error.json_path, "-", error.message)
print("valid" if not errors else f"{len(errors)} errors")

The validator above reports the same three failures for this data and schema, with the line and rule for each, which makes it a quick way to test a schema before it goes into code.

Frequently asked questions

Which JSON Schema drafts are supported?
Draft-07, 2019-09 and 2020-12 are supported natively, chosen from the $schema URL in your schema. Draft-06 schemas validate under draft-07, and draft-04 schemas are checked with draft-07 rules, so review any boolean exclusiveMinimum or exclusiveMaximum values.
Does the validator check formats like email and date?
Yes. The ajv-formats plugin is loaded, so email, date, date-time, time, uri, uuid, ipv4, ipv6, hostname and other standard formats are enforced. A value such as 1990-02-30 fails format: date because February 30 does not exist.
Why is my schema reported as invalid?
The schema is checked against its own meta-schema before it is used. Typical causes are a type name that does not exist, required written as a string instead of an array, or a misspelled keyword value. Fix the reported problem and validate again.
Can I validate against a schema that uses remote $ref URLs?
Remote references are not fetched. Move the referenced definitions into the same schema under $defs (or definitions for draft-07) and point $ref at #/$defs/Name instead.
What does the line number next to each error mean?
It is a best-effort pointer to where the failing property sits in your data, found by searching for the keys along the error path. For errors inside arrays it points to the array's parent key.

Last updated October 3, 2026

Guides

Related tools

JSON Schema to Sample JSON Generate realistic fake JSON that conforms to a JSON Schema — formats, enums, ranges and required fields respected. JSON Schema to TypeScript Turn JSON Schema into TypeScript interfaces and types with optional properties, enums, $ref definitions and JSDoc comments. JSON to Mongoose Schema Generate a Mongoose schema and model from a sample JSON document, detecting Date, ObjectId, arrays and nested objects. JSON Validator Validate JSON online and find syntax errors fast. Get the exact line and column of each problem and fix broken JSON in one click. Credit Card Validator Check credit card numbers with the Luhn algorithm, detect Visa, Mastercard, Amex and more, and verify length. Runs 100% locally. CSS Validator Validate CSS online: find unclosed braces, missing semicolons and other syntax errors. JSON Serialize Online Serialize JSON into its most compact transport form, optionally wrapped as an escaped string literal for storage or messaging. JSON Sorter Sort JSON keys alphabetically at every level, ascending or descending. Optionally sort arrays of values for clean, comparable output. JSON Stringify Online Stringify JSON into an escaped string literal, exactly like JSON.stringify. Ready to embed JSON inside JSON, code or config values. JSON Syntax Highlighter Syntax highlight JSON with light, dark or Monokai themes and copy the colourised HTML for blogs, docs and slides. JSON to JSONL Converter Convert a JSON array to JSON Lines (JSONL / NDJSON), one record per line, for streaming, logging, BigQuery and ML datasets. JSON to One Line Convert multi-line JSON to a single line. Collapse formatted JSON for logs, CLI arguments, environment variables and CSV cells.