Last updated:
JSON Schema Validator
Paste a JSON Schema and JSON data to validate one against the other. This JSON Schema validator reads drafts 4, 6, 7, 2019-09 and 2020-12, and gives clear, human-readable error messages with path locations and fix suggestions.
Free JSON Schema Validator
JSON Schema is the standard way to describe the structure of JSON data. It lets you define what properties an object should have, what types those properties should be, which ones are required, and what constraints to enforce — then validate actual data against those rules. Our validator runs the industry-standard Ajv library directly in your browser, supporting all modern JSON Schema drafts from Draft 4 through Draft 2020-12.
What Is JSON Schema and Why Validate Against It?
JSON Schema is a declarative vocabulary for annotating and validating JSON documents. Think of it as a contract or blueprint for your data. Where a TypeScript interface describes the shape of a JavaScript object at compile time, JSON Schema describes and validates the shape of JSON data at runtime — and across any programming language.
A JSON Schema is itself a JSON document that describes the type of each property (string, number, boolean, object, array, null), required vs. optional properties, string formats (email, URI, date-time, UUID), numeric ranges (minimum, maximum), string constraints (minLength, maxLength, pattern), array rules (minItems, maxItems, uniqueItems), and nested object structures. Schemas can also express conditional logic, composition (allOf, anyOf, oneOf), and references to reusable definitions via $ref.
Validation matters because JSON is weakly structured by nature. A JSON object can contain any key with any value, and nothing about the format itself prevents a client from sending a string where you expected a number, or omitting a required field entirely. Without validation, these malformed payloads propagate through your application until they cause a cryptic error deep in your business logic — or worse, silently corrupt data. Validating at the boundary (when data enters your system) catches these issues immediately with clear, actionable error messages rather than letting them cascade into harder-to-diagnose failures downstream.
The Ajv library that powers this validator is the most widely adopted JSON Schema validator in the JavaScript ecosystem. It is used by tools like ESLint, webpack, and the VS Code JSON language service. By running Ajv directly in your browser, you get the same validation engine used in production systems — without sending your data to any server.
JSON Schema Drafts: Draft 4 vs 6 vs 7 vs 2019-09 vs 2020-12
JSON Schema has evolved through several drafts, and a schema written for one draft can mean something different, or not compile at all, in another. Many "my schema doesn't validate" problems are draft mismatches. The validator uses the draft the schema's $schema keyword names, or the one chosen in the Draft menu when there's none. Each section below shows, in three lines, a change that draft made.
Draft 4
The oldest draft still in wide use, common in legacy systems and older OpenAPI 2.0 specs. It has the building blocks: types, required, enum, pattern, $ref, and composition with allOf/anyOf/oneOf. Its schema identifier is id, without the dollar sign, and exclusiveMinimum and exclusiveMaximum are true/false flags that modify minimum and maximum:
"type": "number",
"minimum": 0,
"exclusiveMinimum": true This accepts 0.01 and rejects 0: "at least 0, but not 0".
Draft 6
Draft 6 renamed id to $id and made exclusiveMinimum and exclusiveMaximum numbers in their own right. It also added const, contains, propertyNames and examples:
"$id": "https://example.com/price.json",
"type": "number",
"exclusiveMinimum": 0 This also rejects 0, without a minimum. Checked as Draft 4, the same schema doesn't compile, because Draft 4 expects exclusiveMinimum to be true or false.
Draft 7
Draft 7 added conditional schemas with if/then/else, plus readOnly, writeOnly and $comment. It's the most widely supported draft and a safe default when you need broad tooling compatibility:
"if": { "properties": { "country": { "const": "US" } } },
"then": { "required": ["zip"] },
"else": { "required": ["postcode"] } An object with "country": "US" now needs a zip, and any other country needs a postcode. Draft 6 doesn't define these keywords, and a validator that implements only Draft 6 skips keywords it doesn't know, so the condition is never checked.
Draft 2019-09
A major restructuring into vocabularies. It replaced definitions with $defs and added unevaluatedProperties and unevaluatedItems, which see the properties every subschema evaluated, so "no extra properties" finally works with allOf:
"allOf": [{ "properties": { "id": { "type": "integer" } } }],
"properties": { "name": { "type": "string" } },
"unevaluatedProperties": false This accepts {"id": 1, "name": "a"} and rejects any other property. With additionalProperties: false in its place, id itself would be rejected, because additionalProperties only sees the properties next to it. Checked as Draft 7, unevaluatedProperties is ignored and extra properties pass.
Draft 2020-12
The latest stable draft. It split the overloaded items into prefixItems, for the positions of a tuple, and items, for everything after them, and replaced $recursiveRef with $dynamicRef and $dynamicAnchor. Use it for new projects unless your tools only support older drafts:
"type": "array",
"prefixItems": [{ "type": "number" }, { "type": "number" }],
"items": false This accepts a pair of numbers such as [1, 2] and rejects a third item. Checked as Draft 2019-09 the same schema means something else: prefixItems is unknown there, and items: false rejects every item, so [1, 2] fails.
Common Validation Errors and How to Fix Them
When validation fails, our validator shows the JSON path to the error, what was expected, what was found, and a suggested fix. Here are the errors developers encounter most often and how to resolve them:
Type mismatch. The most common error. Your schema says "type": "number" but the data contains a string like "42". This frequently happens when reading values from CSV files, query parameters, or form inputs where everything arrives as a string. The fix is either to coerce the value before validation or to use a more permissive schema that accepts both types.
Missing required property. The schema declares a property in the required array, but the data object does not include it. Check whether the property name matches exactly (JSON keys are case-sensitive) and whether the data is nested at the expected depth. A common mistake is declaring "required": ["userName"] when the data uses "username".
Additional properties not allowed. If your schema sets "additionalProperties": false, any property not explicitly listed in properties will fail validation. This is intentional — it catches typos in property names and prevents unexpected data from passing through. The fix is either to add the extra property to your schema or remove it from the data. When composing schemas with allOf, be careful: additionalProperties only knows about properties defined in the same schema object, not in sibling allOf entries. Use unevaluatedProperties (Draft 2019-09+) for composed schemas.
Pattern mismatch. The data string does not match the pattern regex. Remember that JSON Schema patterns are implicitly anchored with a partial match — the pattern "^[A-Z]" only checks that the string starts with a capital letter, not that the entire string is uppercase. If you want a full-string match, anchor both ends: "^[A-Z]+$".
Format validation failure. Keywords like "format": "email" or "format": "date-time" validate that the string matches the expected format. A common issue is using "format": "date" (expects 2024-01-15) when the data contains a full datetime (2024-01-15T10:30:00Z) — use "format": "date-time" instead.
Real-World Use Cases
API contract testing. Define your API's request and response shapes as JSON Schemas, then validate actual payloads against them in your test suite. This catches breaking changes — a renamed field, a new required property, a type change — before they reach production. Both the API producer and consumer can validate against the same schema, ensuring both sides of the contract stay in sync.
Configuration file validation. JSON Schema powers the config validation in VS Code (settings.json, launch.json), ESLint (.eslintrc.json), TypeScript (tsconfig.json), and many other tools. When you see autocomplete and error squiggles in your editor for JSON config files, that is JSON Schema validation at work. You can add the same validation to your own application's config files by writing a schema and validating on startup.
Form validation. Use a single JSON Schema as the source of truth for both frontend form validation (showing inline errors as the user types) and backend API validation (rejecting invalid submissions). Libraries like react-jsonschema-form and Ajv make this practical. When the schema changes, both validation layers update automatically.
Data pipeline validation. In ETL pipelines, validate data at each stage — after extraction, after transformation, and before loading — to catch structural errors immediately. A missing column after a CSV parse or a null value in a non-nullable field is much easier to diagnose at the point of origin than after it has propagated through three downstream systems.
How to Use This Validator
- Enter your schema. Paste a JSON Schema in the left pane. You can write one from scratch or choose a sample from the dropdown — we provide schemas for user profiles, API responses, e-commerce orders, and config files.
- Enter your data. Paste the JSON data you want to validate in the right pane. The data should be a valid JSON document (object, array, or primitive) that you want to check against the schema.
- Review results. Validation runs automatically as you type (with a 600ms debounce). Green means valid; red means errors. Each error shows the exact JSON path, a human-readable explanation of what went wrong, the expected vs. actual values, and a suggested fix.
- Choose your draft. If your schema has a
$schemakeyword, the validator uses the draft it names. Otherwise it uses the draft you pick in the selector (Draft 2020-12 by default). The result says which draft was used. - Share your results. The current schema and data are encoded in the URL hash, so you can copy the browser URL to share a pre-loaded validation state with a colleague. Any text works, including accented letters and emoji. Links are capped at 32 KB; above that, the tool says the input is too large to share by link.
Related Tools
Need to create a schema from an existing JSON example? Use our JSON to Schema Generator to automatically infer a schema from your data. Is your data in YAML? Convert it with the YAML to JSON converter before validating it. Want to generate test data that conforms to your schema? Try our Mock Data Generator. Is the schema part of an OpenAPI spec? The OpenAPI Validator checks the spec itself and validates a response against an operation's schema, with OpenAPI 3.0's nullable handled. For structured data markup, see our JSON-LD Generator and Schema Markup Validator. To learn more about JSON Schema fundamentals, read our Complete Guide to JSON Schema.
Frequently Asked Questions
How do I validate JSON against a JSON Schema?
Paste the schema in the JSON Schema box and the JSON in the JSON Data box. The validator picks the draft from the schema's $schema keyword, or from the Draft menu when there's none, and lists every error with the path to the failing value. The draft sections below show what changed between drafts.
How do I check that a JSON Schema itself is valid?
Validate any data against it: before checking the data, the validator compiles the schema with its draft, and a schema that breaks the draft's rules is reported as a schema compilation error instead of a result. A Draft 6 style "exclusiveMinimum": 0 in a schema checked as Draft 4, where the keyword must be true or false, is one example.
Is my data sent to a server when I validate?
No. The validator runs entirely in your browser using the Ajv library compiled to JavaScript. Your schema and data never leave your device. We record anonymous usage metadata about each validation: the draft, the sizes, and the number of errors and their kinds (such as a missing required property), never the schema or the data.
Which JSON Schema draft should I use for a new project?
Use Draft 2020-12 if your toolchain supports it. It has the clearest semantics, especially for array validation (prefixItems/items) and composed schemas (unevaluatedProperties). If you need broader compatibility with older tools and libraries, Draft 7 is the safest choice — it is the most widely supported draft in production systems.
Why does my schema pass validation but not work in my application?
The most common reason is a draft mismatch. If your application uses Ajv configured for Draft 7 but your schema uses Draft 2020-12 keywords like prefixItems, those keywords will be silently ignored. Make sure the $schema keyword in your schema matches the draft your application is configured to use.
Can I validate YAML data against a JSON Schema?
JSON Schema validates JSON data, not YAML directly. However, since YAML is a superset of JSON, you can convert your YAML to JSON first, for example with the YAML to JSON converter, and then validate the JSON here. Watch for values that change type on the way: an unquoted 1.0 becomes a number, and YAML 1.1 parsers read no as false and a date as a timestamp, where your schema may expect strings. The converter lists each of them.
What is the difference between additionalProperties and unevaluatedProperties?
additionalProperties only sees properties defined in the same schema object's properties keyword. When you compose schemas with allOf, it does not know about properties defined in sibling schemas, leading to unexpected validation failures. unevaluatedProperties (available in Draft 2019-09+) is aware of all properties evaluated by any subschema, making it the correct choice for composed schemas.