JSON Schema Validator
About the JSON Schema Validator
This JSON Schema validator checks a JSON document against a schema in draft-07, draft 2019-09 or draft 2020-12 and lists every rule it breaks, each with a readable path, a JSON Pointer and the failing keyword. Pick a draft (or let it read $schema), paste a schema and some data, click Validate, and see exactly which field is wrong and why.
What is JSON Schema?
JSON Schema is a vocabulary for describing the shape of JSON data: which properties exist, their types, which are required, and what values are allowed. A schema is itself a JSON document, so it can be versioned and shared like code.
It is used to validate API requests and responses, describe OpenAPI models, check configuration files, and drive form generators. Draft-07 is still the most widely supported version across libraries such as Ajv, jsonschema for Python and everit for Java.
Common JSON Schema keywords
type sets the allowed type (string, number, integer, boolean, object, array, null). required lists properties that must be present, and additionalProperties: false rejects any property not listed in properties.
Strings can be limited with minLength, maxLength, pattern and format (for example email or date-time). Numbers use minimum, maximum and multipleOf. Arrays use items, minItems, maxItems and uniqueItems. enum and const restrict a value to a fixed set.
Schemas can be combined with allOf, anyOf, oneOf, not and if/then/else, and shared parts are reused with $ref, for example {"$ref": "#/definitions/address"}.
Reading the error paths
Each error shows two forms of the same location. The readable path starts at $ for the document root: $.address.zip is the zip property of address, and $.tags[1] is the second item of the tags array. Below it is the JSON Pointer (RFC 6901) for the same value, such as /address/zip or /tags/1; the root is shown as (root).
The keyword badge tells you which rule failed. A required error on $.address means a property is missing from that object, while a pattern error on $.address.zip means the value exists but does not match the regular expression.
Choosing a draft: draft-07, 2019-09 or 2020-12
With Auto, the draft comes from the $schema URI in your schema and falls back to draft-07 when it is missing. Choosing a draft yourself overrides $schema, and a note tells you when the two disagree.
Draft-07 uses definitions, dependencies, tuple arrays in items with additionalItems, and ignores every keyword placed next to $ref. Draft 2019-09 adds dependentRequired, dependentSchemas, minContains/maxContains, unevaluatedProperties, unevaluatedItems, $anchor and lets keywords sit next to $ref. Draft 2020-12 replaces the tuple form with prefixItems plus items, and $recursiveRef with $dynamicRef.
Keywords that the chosen draft does not define are ignored, and the result lists them so a schema never passes silently because of a draft mismatch. Not supported in any draft: remote $ref URLs, $id inside subschemas, $vocabulary and contentSchema. Draft-04 and draft-06 schemas are checked as draft-07.
How to Use the JSON Schema Validator
- Choose a Draft (Auto reads $schema and falls back to draft-07), then paste your schema into the JSON Schema box and your document into the JSON Data box, or click Load example for a matching pair.
- Click Validate, or press Ctrl/Cmd + Enter.
- Read the result: a green "Valid" message, or every error with its readable path, JSON Pointer, failing keyword and message. Copy the list or Download it as JSON, fix the schema or data and validate again.
JSON Schema Validator Examples
Required, type and range errors (draft-07)
The schema declares no draft, so Auto uses draft-07. Every failing rule is listed, not just the first.
Input:
Schema:
{"type":"object","properties":{"name":{"type":"string","minLength":2},"age":{"type":"integer","minimum":0}},"required":["name","email"]}
Data:
{"name":"A","age":-1.5}
Output:
Invalid (Draft-07), 4 errors $ [required] Missing required property "email" $.name (/name) [minLength] Must be at least 2 characters, got 1 $.age (/age) [type] Expected integer, got number $.age (/age) [minimum] Must be >= 0, got -1.5
Tuple with prefixItems (draft 2020-12)
The $schema line selects draft 2020-12 under Auto. The third item is rejected because items is false.
Input:
Schema:
{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"array","prefixItems":[{"type":"number"},{"type":"number"}],"items":false}
Data:
[51.5,-0.12,100]
Output:
Invalid (Draft 2020-12), 1 error $[2] (/2) [false] No value is allowed here (schema is false)
unevaluatedProperties (draft 2020-12)
Properties that no properties, patternProperties or subschema covers are rejected, even when some properties come from allOf or $ref.
Input:
Schema:
{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"integer"}},"required":["id"],"unevaluatedProperties":false}
Data:
{"id":"7","debug":true}
Output:
Invalid (Draft 2020-12), 2 errors $.id (/id) [type] Expected integer, got string $.debug (/debug) [unevaluatedProperties] Property "debug" is not allowed: no properties, patternProperties or subschema evaluates it
Common Errors
- "Could not validate: Schema is not valid JSON" with a line and column.
- The schema box must hold strict JSON. Remove trailing commas, comments and single quotes, and quote every key.
- A 2019-09 or 2020-12 keyword such as prefixItems or unevaluatedProperties does nothing, and the result lists it as ignored.
- Draft-07 does not define it. Pick Draft 2019-09 or 2020-12, or add the matching $schema URI and leave the draft on Auto.
- Keywords written next to $ref have no effect.
- In draft-07 everything next to $ref is ignored. Switch to draft 2019-09 or 2020-12, or wrap the reference and the extra keywords in allOf.
- "Only references inside this schema are supported" for a $ref such as https://example.com/address.json.
- Remote references are not fetched. Copy the referenced schema under $defs (or definitions) and use #/$defs/name.
- The result says the schema is invalid because, in draft 2020-12, items must be a schema and not an array.
- The array form of items is draft-07 and 2019-09. In 2020-12 write the tuple as prefixItems and use items for the remaining items.
Frequently Asked Questions
- Is my schema or data uploaded?
- No. Validation runs in your browser with a built-in validator. Neither the schema nor the data is sent anywhere.
- Which JSON Schema drafts are supported?
- Draft-07, draft 2019-09 and draft 2020-12. Draft-04 and draft-06 schemas are checked as draft-07, so draft-04 differences such as a boolean exclusiveMinimum are not handled. Remote $ref URLs, $id inside subschemas, $vocabulary and contentSchema are not supported. format is always checked for the formats named under Format checks, although the 2019-09 and 2020-12 specs treat it as an annotation by default.
- What changes between draft-07, 2019-09 and 2020-12?
- Draft-07 ignores keywords next to $ref and uses dependencies. 2019-09 adds dependentRequired, dependentSchemas, minContains, maxContains, unevaluatedProperties, unevaluatedItems and $anchor. 2020-12 replaces the tuple form of items with prefixItems, so items then means "all remaining items".
- Why does extra data pass validation?
- By default JSON Schema allows properties you did not list. Add "additionalProperties": false to an object schema to reject them, or "unevaluatedProperties": false in 2019-09 and 2020-12, which also sees properties declared through allOf and $ref.
- Can I reference an external schema with $ref?
- No. Only references inside the same schema are resolved: #, #/definitions/name, #/$defs/name and anchors. Inline the external schema under $defs and point to it from there.
- What is the difference between anyOf and oneOf?
- anyOf passes when at least one subschema matches. oneOf passes only when exactly one matches, so data that fits two branches fails.