Skip to content
Tools

JSON Schema Validator

Last updated:

Paste a JSON Schema and a JSON document to check whether the document conforms, with every violation listed by path and keyword. Unlike a syntax validator, it tests the meaning of your data: types, required fields, ranges and patterns.

Runs in your browser: both the schema and the data never leaves your device – nothing is uploaded, logged or stored on a server. How we protect your data

100% in-browserNothing is uploaded

Schema

Loading editor…

Paste a JSON Schema

or drop a file anywhere in this box. Everything stays in your browser.

Drop a file to load it

Document

Loading editor…

Paste the JSON to check

or drop a file anywhere in this box. Everything stays in your browser.

Drop a file to load it

Result

Paste a schema and a document

Results update as you edit either side.

How to use the JSON Schema Validator

  1. Paste the schema in the schema pane (it must itself be valid JSON).
  2. Paste the document to check in the data pane.
  3. Read the error list: each entry gives the instance path, the schema keyword that failed and a message.
  4. Fix the data or the schema and re-check; results update as you edit.

Worked example

A record that misses a required field and breaks a minimum

Schema

{
  "type": "object",
  "required": ["id", "email"],
  "properties": {
    "id": { "type": "integer", "minimum": 1 },
    "email": { "type": "string" }
  }
}

Data

{"id":0}

Errors

(root)  required  must have required property 'email'
/id     minimum   must be >= 1

Both problems are reported in one pass. Message wording varies slightly between validators; the path and keyword are what to act on.

Errors you will meet most

Errors you will meet most
KeywordMeaningTypical fix
typeValue has the wrong JSON type"42" vs 42: send a number, or allow string
requiredA listed key is missingAdd it, or remove it from required
additionalPropertiesKey not declared in propertiesFix a typo or declare the key
enumValue not in the allowed listCheck case and spelling
minimum / maximumNumber out of rangeCheck units and limits
patternString does not match the regexRegex is not anchored unless it uses ^ and $
oneOfMatched zero or more than one subschemaMake branches mutually exclusive

Why "format" may not fail

In draft 2019-09 and 2020-12, format is an annotation by default: "format": "email" describes the field but validators are not required to reject a bad email. Some validators enable format assertion as an option. If you need the check guaranteed, add a pattern as well.

Reading oneOf and anyOf errors

When a oneOf fails, a validator reports errors from every branch, which can look like a wall of unrelated messages. Find the branch that was meant to match (usually by a type or kind property) and read only its errors. If data matches two branches, oneOf also fails – use anyOf if overlap is acceptable.

Remote $ref URLs are not fetched; paste referenced definitions into $defs in the same schema.

JSON Schema Validator FAQ

What is the difference between a JSON validator and a JSON Schema validator?

A JSON validator checks syntax only: is this parseable JSON? A JSON Schema validator checks content against rules: are the right keys present with the right types and values?

Which JSON Schema drafts are supported?

Draft 2020-12 is the main target, and the $schema keyword in your schema selects the draft. Draft-07 schemas are still very common and validate with the same core keywords.

Why does my schema accept data with extra keys?

JSON Schema allows additional properties unless you set "additionalProperties": false (or unevaluatedProperties: false when combining subschemas).

How do I validate JSON Schema in code?

In JavaScript, Ajv: const validate = ajv.compile(schema); validate(data). In Python, jsonschema.validate(instance=data, schema=schema). Both report errors by path and keyword.

Does pattern need ^ and $ in JSON Schema?

Yes, if you want a full match. pattern matches anywhere in the string, so "[0-9]+" accepts "abc1". Use "^[0-9]+$" to require digits only.

Related tools