TXT · Text & Data tools

JSON Schema Validator

Draft
Schema
Document
Validation errors

Errors appear here as instancePath keyword message

Paste a schema and a document

—draftwaitingresult0errors0document chars

Shareable link

Settings are written to the URL as you change them. Nothing differs from the defaults yet.

Validate a JSON document against a JSON Schema and read every failing keyword with the exact path inside the document. The compiler is Ajv, the same validator most Node tooling uses, so a schema that passes here behaves the same way in a CI step or an API gateway.

Schema on the left, document on the right

Paste the schema into the left pane and the document to test into the right one. Both panes parse as you type, and a JSON syntax error shows under the pane it belongs to before any validation runs.

The draft is read from the schema’s $schema field. https://json-schema.org/draft/2020-12/schema selects draft 2020-12, https://json-schema.org/draft/2019-09/schema selects 2019-09, and anything else, including no $schema at all, falls back to draft-07. The Draft selector overrides that detection when you want to see how the same schema behaves under a different version.

Press Load example to fill both panes with a user record schema and a document that fails it in four places.

Reading the error list

Each error is one line in three columns: the instance path, the keyword, and the message.

/           required              must have required property 'id'
/email      format                must match format "email"
/roles/0    enum                  must be equal to one of the allowed values ["admin", "editor", "viewer"]
/           additionalProperties  must NOT have additional properties (nickname)

The instance path is a JSON Pointer into the document. /roles/0 is the first item of the roles array. An empty path, printed as /, points at the root, which is where a missing required property is reported because the object as a whole is incomplete.

With All errors on, the validator keeps going after the first failure and lists everything. Turn it off to stop at the first error, which is how Ajv runs by default in production for speed, and which can hide a second problem behind the first.

Example: a schema that rejects a document

Schema:

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "required": ["id", "email"],
  "properties": {
    "id": { "type": "integer", "minimum": 1 },
    "email": { "type": "string", "format": "email" }
  },
  "additionalProperties": false
}

Document:

{ "id": 0, "email": "sam", "nickname": "sam" }

Result: three errors. /id fails minimum because 0 is below 1. /email fails format because sam has no @. The root fails additionalProperties because nickname is not declared. Remove additionalProperties: false and the third error disappears while the first two stay.

Strict mode

Ajv’s strict mode is off by default on this page. On, it refuses to compile schemas that use keywords it does not know, that declare properties without type: "object", or that combine keywords in ways the specification leaves undefined. Those schemas are common in the wild and still validate correctly, so the default keeps them working. Turn strict on when writing a schema from scratch: the compile error points at the ambiguity before it reaches a consumer that interprets it differently.

Formats

format is an annotation in draft 2019-09 and 2020-12, which means a conforming validator may ignore it. With Check formats on, the page enforces the standard set from ajv-formats: date, time, date-time, duration, email, hostname, ipv4, ipv6, uri, uri-reference, uuid, regex, json-pointer, and a few more. A format outside that list fails to compile under strict mode and is ignored otherwise.

Turn the checkbox off to see how the document fares under a validator that treats format as documentation only.

Remote references

A $ref that points at an http or https URL is not fetched. The schema pane reports it as a compile error instead of silently passing the branch. Paste the referenced schema into $defs (or definitions in draft-07) and change the reference to a local pointer:

"address": { "$ref": "#/$defs/address" }

References inside the same document, including recursive ones, resolve normally.

JSON Schema is not JSON-LD

The two are often confused because both contain the word schema. JSON Schema describes the shape of data: which properties exist, their types, their ranges. JSON-LD with Schema.org vocabulary is markup that tells search engines what a page is about. A product feed is validated here. A product rich-result snippet is checked with the JSON-LD Schema Validator.

To go the other way and produce a schema from a sample document, the JSON Schema Generator infers one, which you can then paste into the left pane and tighten.

Frequently Asked Questions

It compiles the schema in the left pane and tests the document in the right pane against it. Every keyword that fails (type, required, enum, minimum, pattern, format, additionalProperties, and the rest) is listed with the path inside the document where it failed.

Draft-07, draft 2019-09, and draft 2020-12. On Auto the draft is read from the schema's $schema field; a schema without one is treated as draft-07. Pick a draft by hand to test how a schema behaves under a different version.

No. JSON Schema describes the shape of a JSON document for an API or config file. JSON-LD with Schema.org vocabulary is structured data for search engines. Use the JSON-LD Schema Validator for rich results; use this page for API payloads, configuration files, and data contracts.

It is a JSON Pointer to the value that failed, such as /roles/0 for the first item of the roles array. An empty path, shown as /, means the error is about the document root, for example a missing required property.

The validator does not fetch remote schemas, so a $ref pointing at an http or https URL cannot be resolved. Paste the referenced schema into $defs and change the $ref to a local pointer such as #/$defs/address.

Strict mode rejects schemas that use unknown keywords, ignored keywords, or ambiguous constructs such as properties without a type. It is off by default so schemas written for other validators still compile. Turn it on when authoring a new schema and you want the stricter feedback.

Yes, when Check formats is on. The checker covers the standard formats: date, time, date-time, email, hostname, ipv4, ipv6, uri, uuid, regex, and others. Turning it off makes format an annotation only, which is the default behaviour in draft 2019-09 and later.

Explore Our Tools

Browse all tools