Developer tool

JSON Schema Validator

Paste a JSON value and a JSON Schema. Both are checked locally in your browser.

Runs in your browser. No upload.

Values are processed locally in this browser.

Result

—

About this tool

JSON Schema Validator made simple.

Validate data and the schema itself using draft-07 or 2020-12. Local references, known formats and uniqueness checks run in a cancellable browser worker. Remote schemas are not downloaded. Very slow expressions are stopped to keep the page usable. Large numeric identifiers outside exact browser precision are rejected; use strings for those identifiers.

Guide

Using JSON Schema Validator

The JSON Schema Validator checks a JSON value against a JSON Schema written for draft-07 or draft 2020-12. It first checks that the schema itself is valid, then lists each place where your data breaks it, with a path and a short reason. Local references and common formats are supported. It does not download remote schemas and it does not fix your data.

How to use it

  1. Paste the JSON value you want to test into the JSON data box. It can be an object, a list or a single value.
  2. Paste your schema into the JSON Schema box. Add a $schema line for draft-07 or draft 2020-12. Without that line the tool uses draft-07.
  3. Press Calculate. A result starting with Valid means the data matches. A result starting with Invalid lists each problem with a path such as #/age and a keyword.
  4. Change the data or the schema and press Calculate again. Copy result copies the list, and Clear empties both boxes.

Worked examples

Data that matches

You enter
Json
{"name":"Ada","age":36}
Schema
{"type":"object","required":["name","age"],"properties":{"name":{"type":"string","minLength":1},"age":{"type":"integer","minimum":0}},"additionalProperties":false}
You get
Result
Valid · JSON matches the schema (draft 7; known formats checked).

Both required fields are present, the name is not empty, the age is a whole number of at least zero, and there are no extra properties. No $schema line was given, so draft 7 is used.

Run through the tool’s own code.

Several problems at once

You enter
Json
{"name":"","age":-1,"x":1}
Schema
same schema as above
You get
Result
Invalid · 6 issues #: properties: Property "name" does not match schema. #/name: minLength: String is too short (0 < 1). #: properties: Property "age" does not match schema. #/age: minimum: -1 is less than 0. #: additionalProperties: Property "x" does not match additional properties schema. (additional property is not allowed) #/x: false: False boolean schema.

There are three real mistakes: an empty name, a negative age and an extra property x. The count says 6 because each mistake is listed twice, once as a summary line at the parent path and once at the exact path.

Run through the tool’s own code.

A required field is missing

You enter
Json
{"name":"Ada"}
Schema
same schema as above
You get
Result
Invalid · 1 issues #: required: Instance does not have required property "age".

The path # means the whole value. The tool writes 1 issues even for one problem, so do not read the plural as a second error.

Run through the tool’s own code.

A reference to a remote schema

You enter
Json
{"a":1}
Schema
{"$ref":"https://example.com/x.json"}
You get
Message
JSON Schema: Unresolved $ref "https://example.com/x.json".

The tool never downloads schemas from the web. A reference it cannot find inside your own schema stops the check with a message like this, which also adds a short list of known schemas. Put the needed parts in $defs or definitions.

Run through the tool’s own code.

When it helps

  • Check that a sample API response or a config file follows the schema your team agreed on.
  • Test a new schema against one good and one bad example before you put it in a project.
  • Find out which field breaks a rule when a larger validator only says that something failed.
  • Learn how keywords such as required, minimum, format and uniqueItems behave by trying small inputs.

Limits to keep in mind

  • Only draft-07 and draft 2020-12 are accepted. A schema that names another draft, such as draft-04, is refused with a message about supported drafts.
  • References must point inside the schema you paste. Remote schemas are not downloaded, and a reference that cannot be resolved stops the check.
  • Whole numbers that cannot be held exactly in the browser, such as 9007199254740993, are rejected in the data and the schema. Write large identifiers as strings.
  • A format name the tool does not know gives an error instead of being skipped, and a check that runs too long is stopped after a few seconds to keep the page usable.

Tips

  • Read the lines with deeper paths, like #/age, first. The lines at # only repeat that something below them failed.
  • Always add a $schema line, so the draft is stated and you do not rely on the default of draft-07.
  • Try a data sample that is clearly valid and one that is clearly broken. If both give the same result, the schema is too loose or too strict.

Sources

Common questions

About JSON Schema Validator.

Which JSON Schema draft does the validator use?

It reads the $schema line of your schema and supports draft-07 and draft 2020-12. If there is no $schema line, it uses draft-07 and says so in the result. A schema that names any other draft is refused.

Does it check the schema itself?

Yes. Before the data is tested, the schema is checked against the official meta-schema of its draft. A mistake such as an unknown type name stops the run and the message says the schema is invalid.

Are formats such as email or date-time checked?

Known formats are checked. A value like not-an-email fails the email format. A format name the tool does not recognise causes an error rather than being ignored, so remove or change it.

Why does it report more issues than I have mistakes?

Each failure is listed at its own path and again as a summary at the parent. In the example above, three real mistakes give six lines. Start with the lines that have the longest paths.

Can it use schemas from a URL?

No. Remote schemas are not downloaded, so the tool works without any network request. Local references inside your pasted schema, for example to $defs, do work.

Is my data uploaded?

No. The check runs inside your browser in a background worker, and neither the data nor the schema is sent to a server.

Why is a very large number refused?

Browsers keep whole numbers exactly only up to a limit. A number past it would be silently rounded, which could give a wrong result, so the tool rejects it. Put such identifiers in quotes and use a string type.

How do I use JSON Schema validator?

Paste a JSON value and a JSON Schema. Both are checked locally in your browser.

Is my data uploaded to a server?

No. This tool runs locally in your browser. Your input is not uploaded.