Skip to content
DevTrove

JSON & Data

JSON Schema Validator

Check JSON data against a JSON Schema (Draft 2020-12 or Draft-07) in your browser, with exact numbers and a path for every error.

Runs in your browser

Press Ctrl+Enter (⌘+Enter on Mac) in either box to validate.

How to use

  1. Paste your JSON Schema into Schema and the JSON to check into JSON data.
  2. If the schema has no $schema keyword, choose its version with Draft. A $schema in the schema always wins.
  3. Select Validate, or press Ctrl+Enter (⌘+Enter on Mac) in either box.
  4. Read the result: Valid, or a list of errors. Each error shows where in the data it is (a JSON Pointer path such as /users/0/email), what is wrong, the keyword that failed and where that keyword is in the schema.
  5. Use Copy errors to copy the result as text.

What is checked

The tool supports JSON Schema Draft 2020-12 and Draft-07. The version comes from the schema's $schema keyword; without one, the version chosen under Draft is used (Draft 2020-12 by default). Other versions, such as Draft-04 or Draft 2019-09, are rejected rather than checked with the wrong rules.

$schema must be the official URI of the draft: https://json-schema.org/draft/2020-12/schema or http://json-schema.org/draft-07/schema#. As compatibility aliases, the same URIs with http and https swapped are also accepted: http://json-schema.org/draft/2020-12/schema and https://json-schema.org/draft-07/schema#. The value must match exactly; any other spelling, such as a missing or extra # or a trailing slash, is reported as an unsupported version.

Before your data is checked, the schema itself is checked against the official metaschema for its version, which is built into the page. An invalid schema, an invalid pattern or a $ref that cannot be resolved is reported as a schema error. A schema error means there is no verdict about the data: the schema has to be fixed first.

Errors are listed in a fixed order: for each part of the schema, keywords are checked in the same sequence every time, and array items and object properties are visited in the order they appear in the data. anyOf, oneOf and not report one error of their own instead of every error inside their subschemas. At most 100 errors are listed; the total is always shown.

Error messages only contain values from the schema, such as a maximum or a required property name. Values from your data are never repeated in messages; the path tells you where the problem is.

Exact numbers

Numbers are compared by their exact decimal value, without floating-point rounding. 9007199254740993 does not satisfy a maximum of 9007199254740992, 1.0000001 is not a multiple of 1, and 0.30000000000000001 is not equal to 0.3, even though JavaScript reads those pairs as the same number. Many validators get these wrong because they convert numbers to floating point first.

1, 1.0 and 1e0 are the same number, and -0 equals 0. A number with no fractional part, such as 1.0, counts as an integer.

References are never downloaded

$ref is resolved only inside the schema you paste: JSON Pointers such as #/$defs/address, $id, $anchor and $dynamicAnchor. A reference to another URL, a file or any other location is never fetched; it is reported as a schema error. To use another schema, copy it under $defs (definitions in Draft-07) and refer to it locally. References to the official Draft 2020-12 and Draft-07 metaschemas work, because they are built in.

Recursive and mutually recursive schemas are supported. Validation stops with a message when references are followed more than 256 levels deep or after 1,000,000 steps.

format is not checked

The format keyword (email, uri, date-time and others) is treated as an annotation, as the 2020-12 specification does by default: it is not checked. When the schema uses format, the page says how many format keywords it found, so you know which values were not checked. Use pattern if a value must be enforced.

Rejected input and limits

Both boxes must contain strict JSON (RFC 8259): comments, trailing commas and single quotes are rejected. An object that repeats a key is rejected, including keys that are only equal after escapes are resolved, such as "a" and "\u0061".

Each box is limited to 1,000,000 characters and to 128 levels of nested arrays and objects. Patterns are JavaScript regular expressions with the u flag.

Validation runs in a background worker and is stopped after 5 seconds, so a pattern that takes too long to match cannot freeze the page. If your browser cannot start a worker, the tool shows an error instead of validating on the page itself. Support has only been checked in Chromium-based browsers; Firefox and Safari are not verified.

FAQ

Are my schema and data uploaded?
No. Validation runs in your browser. The schema and data are not sent to a server, not stored, and not added to the page URL, and references in the schema are never downloaded.
Why does it say my schema has an unresolved $ref?
The reference points outside the schema you pasted, for example to another URL. DevTrove never downloads schemas. Copy the referenced schema under $defs and change the reference to a local one such as #/$defs/name.
Why is an invalid email accepted?
Because format is not checked. JSON Schema treats format as an annotation by default. Use a pattern to enforce a format.
Which JSON Schema versions are supported?
Draft 2020-12 and Draft-07, identified by their official $schema URIs or by the http/https compatibility aliases of those URIs. Other versions and other URIs are rejected with a schema error.