My Tool Studio
Developer

JSON Schema Validator

This JSON Schema validator checks JSON data against a JSON Schema and lists every rule that fails, with the path in your data and the schema rule that caught it. It supports drafts 4, 6 and 7, 2019-09 and 2020-12, and reads the draft from $schema or lets you pick one. Types, required fields, enums, string patterns and formats such as email and date-time, number ranges, array rules, allOf, anyOf, oneOf, not, if/then/else and local $ref are all checked. No schema yet? Paste sample data and press Generate schema from data to get a starting schema. Paste, drop, upload or load both files from a URL. Validation runs in your browser as you type.

Always freeNo sign upRuns in your browser

Paste a schema and some JSON, or press Try sample. Results update as you type.

How to use

01

Add the schema and the data

Paste your JSON Schema on the left and the JSON to test on the right, or upload, drop or load each one from a URL. Try sample loads a schema and a record with several mistakes.

02

Pick the draft and read the result

Leave Draft on Detect from $schema or choose one, and decide whether formats are checked. The result updates as you type and lists each failing rule with its data path.

03

Generate or refine the schema

To start from data, paste JSON on the right and press Generate schema from data. Then tighten the generated rules, such as adding a minimum or an enum, and watch the result.

Why JSON Schema Validator

The sample, error by error

The sample schema describes an account with an id, email, plan, seats, tags and a billing address. The sample data breaks six rules, and the table shows how each one is reported.

DataRule it breaksReported as
"id": 0minimum 1/id must be at least 1
"email": "ana@example"format email/email must be a valid email
"tags": ["beta", "beta"]uniqueItems/tags must not contain duplicates
"country": "pt"pattern ^[A-Z]{2}$/billing/country must match the pattern
"nickname": "ana"additionalProperties falseproperty "nickname" is not allowed
"plan": "team" without seatsif plan is team, then seats is requiredmust have the required property "seats"

Keywords by type

Most schemas use a small set of keywords. This is what each group checks.

Applies toKeywords
Any valuetype, enum, const, allOf, anyOf, oneOf, not, if, then, else, $ref
StringsminLength, maxLength, pattern, format
Numbersminimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf
Objectsproperties, required, additionalProperties, patternProperties, propertyNames, minProperties, maxProperties, dependentRequired, dependentSchemas
Arraysitems, prefixItems, additionalItems, contains, minContains, maxContains, minItems, maxItems, uniqueItems

Common questions

What is JSON Schema?
JSON Schema is a JSON document that describes what other JSON should look like: which properties exist, their types, which are required, allowed values, lengths and patterns. APIs, config files and form builders use it to reject bad data before it causes problems.
Which JSON Schema drafts does this validator support?
Draft 4, draft 6, draft 7, 2019-09 and 2020-12. With Detect from $schema, the $schema URL decides, and draft 7 is used when there is none. The draft changes details such as how exclusiveMinimum works and whether $ref sits alongside other keywords.
How do I read the JSON Schema validation errors?
Each row has three parts. Where in the data is a JSON Pointer such as /billing/country, meaning the country key inside billing. Problem says what is wrong in plain words. Schema rule is the pointer to the keyword that failed, such as #/properties/billing/$ref/properties/country/pattern.
Does the validator check formats like email and date-time?
Yes, while Check formats is ticked. It checks email, date-time, date, time, duration, uuid, ipv4, ipv6, hostname, uri, uri-reference, regex and json-pointer. Unknown formats are skipped with a note. Untick the option to treat format as a description only, which the specification allows.
Can the validator follow $ref to other files?
It follows local references such as #/$defs/address, #/definitions/address, $anchor names and $id values inside the same schema. Remote URLs are not fetched; a note tells you which one was skipped, so paste that schema into $defs and point to it locally.
How do I generate a JSON Schema from JSON data?
Paste an example into the JSON data pane and press Generate schema from data. The schema describes the types it found, marks keys present in every item as required, and adds formats for dates, emails, UUIDs, IP addresses and URLs. Pick the draft and whether extra properties are allowed before you generate.
Which keywords are not checked by this JSON Schema validator?
unevaluatedProperties, unevaluatedItems, $dynamicRef and $recursiveRef are not evaluated, and remote $ref URLs are not fetched. When a schema uses them, a note says so, so you never get a silent pass.
Why does my data fail oneOf when it matches one of the options?
oneOf requires exactly one branch to match. If the data also fits a second branch, for example because neither branch sets additionalProperties to false, it fails with matches 2. Use anyOf if matching more than one is fine, or make the branches mutually exclusive.
Is my schema or data uploaded during validation?
No. Both are parsed and checked by JavaScript in your browser. Load URL is the exception: the site's server fetches that public address, such as a schema from a schema store, and returns the text to the page.

More Developer tools

View all