JSON Schema Validator
Check whether a JSON value matches a JSON Schema (draft 2020-12, 2019-09 or 07) and see where it does not.
Loading the validator…
How to use JSON Schema Validator
- Paste the JSON Schema and the JSON data. Leave Draft on Auto to follow $schema (2020-12 when absent).
- Select Validate. Empty input, invalid JSON and an unusable schema are each reported as their own problem.
- For every error, use the data location (a JSON Pointer) to find the value and the schema location to find the rule.
Example
Input / settings:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"required": ["id", "email"],
"properties": {
"id": { "type": "integer", "minimum": 1 },
"email": { "type": "string", "pattern": "^[^@\\s]+@[^@\\s]+$" },
"role": { "enum": ["admin", "member"] }
},
"additionalProperties": false
}
{
"id": 0,
"email": "not-an-email",
"role": "guest",
"extra": true
}Output:
Invalid: 4 errors (draft 2020-12) /id — #/properties/id/minimum — 0 is less than 1. /email — #/properties/email/pattern — String does not match pattern. /role — #/properties/role/enum — Instance does not match any of ["admin","member"]. /extra — #/additionalProperties — Property "extra" does not match additional properties schema.
The first block is the schema and the second is the data. Paths are shown as data location — schema location — message.
When to use
- Check an API payload against its schema.
- Explain why a configuration file is rejected.
- Test a schema change against sample data.
Overview
JSON Schema describes what a JSON value must look like: its types, required properties, allowed values, number ranges and so on. This tool checks a JSON value against a schema in your browser and lists every place where the value breaks a rule, so you can fix the data or the schema.
Supported input
A JSON Schema (an object, or true/false) and the JSON value to check, each up to 500,000 characters.
Output details
Valid, or a list of errors. Each error has a JSON Pointer to the failing part of your data, the path of the failing keyword in the schema, the keyword and a message. Problems with the input are reported separately from validation errors: empty input, invalid JSON, or an unusable schema.
Format and version scope
- Draft 2020-12 (default), 2019-09 and draft-07. With Auto, the $schema keyword picks the draft; without it, 2020-12 is used. You can also pick a draft yourself, which overrides $schema.
- Other $schema values (for example draft-04 or draft-06) are rejected instead of being checked with different rules.
Limitations
- External $ref values (another file or URL) are never fetched. A schema that needs one is reported as a schema problem; copy the referenced schema into $defs and use a local #/… reference. A $ref that matches an $id inside the same document works.
- The schema itself is not checked against the meta-schema. Only problems that stop validation are reported: invalid JSON, a non-object schema, an unsupported $schema, an invalid pattern, or an unresolved $ref.
- format is checked only for the formats the library knows (such as date-time, email, uri, uuid); unknown formats pass. Format checking can differ from other validators.
- Custom vocabularies and keywords are ignored. Very large inputs are rejected, not truncated.
Common mistakes
- Using a required list inside a property instead of on the object that owns the property.
- Expecting additionalProperties to default to false: by default, unknown properties are allowed.
- Pointing $ref at another file or URL. Copy that schema into $defs and use a local #/$defs/… reference.
Practical tips
- Start with the first error: later ones can follow from it.
- Draft 2020-12 uses prefixItems for tuples; 2019-09 and draft-07 use an items array.
- A JSON value can be valid JSON and still fail the schema; use JSON Validator when you only need to check the syntax.
Privacy and security
This tool runs entirely in your browser. Your input is never uploaded to our servers. The schema and data are checked locally in your browser. They are not uploaded, saved in browser storage, or sent in any request, and external $ref targets are never fetched.
References
Frequently asked questions
Why is my external $ref reported as an error?
This tool never makes a network request, so it cannot download a schema from a URL or another file. Copy the referenced schema into $defs and use a local #/$defs/… reference, or give it an $id inside the same document.
Which JSON Schema drafts are supported?
Draft 2020-12 (the default), 2019-09 and draft-07. Auto follows the $schema keyword; choosing a draft in the menu overrides it. Other drafts such as draft-04 are rejected.
Does it check that my schema is itself valid?
Only partly. It reports invalid JSON, a schema that is not an object or boolean, an unsupported $schema, an invalid pattern and an unresolved $ref. It does not validate the schema against the meta-schema, so a misspelled keyword is simply ignored.