Homeโ€บValidatorsโ€บDataโ€บJSON Schema Validator

JSON Schema Validator

Data

Validate a JSON document against a JSON Schema definition. Supports type, properties, required, items, minimum, maximum, enum, and pattern. Free, client-side.

What is a JSON Schema?

JSON Schema is a vocabulary for describing the shape and constraints of JSON data. A JSON Schema Validator takes two inputs โ€” a schema document and a JSON data document โ€” and checks whether the data conforms to every rule the schema defines. It is the layer that sits between "is this valid JSON?" and "does this JSON have the structure my application expects?"

This tool implements a subset of JSON Schema Draft-07 entirely in your browser. Paste a schema into the JSON Schema textarea and your data into the JSON Data to Validate textarea. The validator parses both, runs every supported keyword check, and produces a clear Valid or Invalid badge. When validation fails, it reports each error with a dot-notation path โ€” for example, root.user.email: expected type "string", got "number" โ€” so you can locate the problem immediately.

All processing is client-side. Your schema and data are never sent to a server, making the tool safe for internal API payloads and configuration files you would prefer to keep private.

For syntax checking without schema constraints, the JSON Validator confirms a string is parseable JSON. For YAML documents, the YAML Validator provides equivalent syntax validation.

How to use this JSON Schema calculator

  1. Paste your JSON Schema into the JSON Schema textarea. The default example shows a schema that requires an object with name (string, non-empty) and age (number, 0โ€“120) properties. Replace it with your own schema.
  2. Paste the JSON document you want to validate into the JSON Data to Validate textarea. The default example shows { "name": "Alice", "age": 30 }, which passes the default schema.
  3. The validator runs automatically as you type. Check the Valid / Invalid badge at the top of the results section.
  4. If the badge shows Invalid, read the error list. Each entry shows the path (e.g. root.name) and the specific rule that failed (e.g. string length 0 < minLength 1). Navigate to that field in your data and apply the fix.
  5. If the badge shows "Schema is not valid JSON" or "JSON data is not valid JSON", use the JSON Validator to fix the syntax of the offending input first, then return here.
  6. Iterate until the Valid badge appears and every required constraint is satisfied.

Tip: if you are testing a schema you are writing rather than data you received, try submitting data that should fail to confirm the schema rejects it correctly โ€” this catches overly permissive schemas before they reach production.

Formula & Methodology

This validator implements a recursive descent algorithm over the JSON Schema keyword set from Draft-07. Given a schema object and a data value, it evaluates every applicable keyword and collects all errors, rather than stopping at the first failure. Error paths are accumulated by passing the current path string (root, root.propertyName, root.arrayName[index]) down through recursive calls.

### Supported keywords by category

Type and value identity
- type โ€” accepts a string or array of strings; "integer" is treated as a subtype of "number" and additionally requires Number.isInteger(value) to be true
- enum โ€” value must deep-equal one of the listed items (compared via JSON.stringify)
- const โ€” value must deep-equal the specified constant

String constraints
- minLength, maxLength โ€” checked against string.length (character count)
- pattern โ€” tested with new RegExp(pattern).test(value)

Number constraints
- minimum, maximum โ€” inclusive bounds
- exclusiveMinimum, exclusiveMaximum โ€” exclusive bounds (Draft-07 number form)
- multipleOf โ€” checked via Number.isInteger(value / multipleOf)

Array constraints
- items โ€” if an object schema, applied to every element; if an array of schemas, applied positionally
- minItems, maxItems โ€” checked against array.length
- uniqueItems โ€” all elements compared via JSON.stringify; first duplicate reported with its index
- contains โ€” at least one array element must match the sub-schema

Object constraints
- required โ€” each listed key must be present in the object
- properties โ€” each defined property is validated recursively against its sub-schema if present
- additionalProperties โ€” if false, any key not in properties is rejected; if an object schema, applied to all keys not in properties
- patternProperties โ€” each key matching the pattern regexp is validated against the associated sub-schema
- minProperties, maxProperties โ€” checked against Object.keys(object).length

Logical combinators
- allOf โ€” data must pass every sub-schema in the array
- anyOf โ€” data must pass at least one sub-schema
- oneOf โ€” data must pass exactly one sub-schema
- not โ€” data must fail the sub-schema

### Working example

Schema โ€” requires an object with a username (string, 3โ€“20 characters) and a role (one of "admin", "editor", "viewer"):

json {   "type": "object",   "required": ["username", "role"],   "properties": {     "username": { "type": "string", "minLength": 3, "maxLength": 20 },     "role": { "type": "string", "enum": ["admin", "editor", "viewer"] }   },   "additionalProperties": false } 

Data that fails โ€” username is too short and role is not in the enum:

json { "username": "ab", "role": "superuser" } 

Errors produced:

root.username: string length 2 < minLength 3 root.role: value must be one of "admin", "editor", "viewer"

### Scope and limitations

This tool does not support:
- $ref โ€” schema references are not resolved; the keyword is silently ignored
- $defs / definitions โ€” referenced sub-schemas via $ref are not inlined
- format โ€” the keyword is accepted but not validated
- if / then / else โ€” conditional application keywords from Draft-07 are not implemented
- Schema vocabularies, $schema declaration enforcement, or annotation collection

For production-grade validation with full Draft-07 support including $ref resolution, use Ajv in your codebase.

Frequently Asked Questions

JSON Schema is a vocabulary for annotating and validating the structure of JSON documents. It lets you describe the shape of a JSON object โ€” which properties exist, what types they must be, which are required, and what constraints their values must satisfy โ€” in a machine-readable format. JSON Schema is widely used for API request and response validation, configuration file validation, and documentation generation. The official website is json-schema.org.
JSON Schema Draft-07 is the seventh iteration of the JSON Schema specification, published in 2018. It introduced keywords such as `readOnly`, `writeOnly`, `$comment`, and the number forms of `exclusiveMinimum` and `exclusiveMaximum` (which changed from booleans in Draft-04 to numbers in Draft-07). Draft-07 remains one of the most widely supported versions in validation libraries such as Ajv and in API specification tools. This validator implements the core validation keywords from Draft-07.
This validator supports: `type`, `properties`, `required`, `items`, `minLength`, `maxLength`, `minimum`, `maximum`, `exclusiveMinimum`, `exclusiveMaximum`, `multipleOf`, `enum`, `const`, `pattern`, `additionalProperties`, `patternProperties`, `allOf`, `anyOf`, `oneOf`, `not`, `minItems`, `maxItems`, `uniqueItems`, `contains`, `minProperties`, and `maxProperties`. These cover the core structural and constraint keywords used in the vast majority of real-world schemas.
No. `$ref` resolution and `$defs` (definitions) are not supported by this validator. Schemas that use `$ref` to reference another schema โ€” either inline via `$defs` or externally via a URL โ€” will not have those references resolved; the `$ref` keyword will be silently ignored during validation. If your schema relies heavily on `$ref`, consider using Ajv locally or a validation endpoint that supports full reference resolution.
No. The `format` keyword (for example, `"format": "email"` or `"format": "date-time"`) is treated as an annotation only in JSON Schema โ€” validators are not required to enforce it, and this tool does not. If you need format enforcement, use a library such as Ajv with the `ajv-formats` plugin configured.
No. Both the schema parsing and the validation logic run entirely in your browser using JavaScript. Your schema and JSON data are never sent to any server, stored in a database, or logged. This makes the tool safe to use with internal API payloads, application configuration files, or any data you would prefer to keep private.
Errors use dot notation to describe the location of the failing value in the JSON document. `root` refers to the top-level document. `root.address` means the `address` property of the root object. `root.items[2]` means the third element of the `items` array. `root.tags[0]` means the first element of the `tags` array. This path notation makes it straightforward to locate the failing value regardless of how deeply nested it is.
Add `"additionalProperties": false` to your schema object alongside your `properties` definition. Any property in the JSON data that is not listed under `properties` will produce an error. If you want additional properties to be allowed but only if they match a specific type, use `"additionalProperties": { "type": "string" }` (or another schema) instead of `false`.
`allOf` requires the data to be valid against every schema in the array โ€” a logical AND. `anyOf` requires the data to be valid against at least one schema in the array โ€” a logical OR. `oneOf` requires the data to be valid against exactly one schema in the array โ€” an exclusive OR. If the data matches two or more schemas in a `oneOf` array, validation fails. These combinators are commonly used to express union types or to compose schemas from multiple reusable parts.
The [JSON Validator](/json-validator/) checks only that a string is parseable JSON โ€” it confirms syntax. The JSON Schema Validator goes further: it checks that a structurally valid JSON document conforms to a defined schema (correct types, required fields present, values within allowed ranges). You need both: the JSON must be syntactically valid before schema validation can even begin.
You can use it to validate individual JSON bodies against the schema fragments defined in an OpenAPI spec, as long as those schemas do not rely on `$ref`. For full OpenAPI document validation โ€” checking that the OpenAPI spec itself is valid โ€” use the [OpenAPI Validator](/openapi-validator/), which validates the entire spec structure.
This tool implements a Draft-07 subset and does not support `$ref`, `$defs`, `if`/`then`/`else`, `format` enforcement, or vocabulary-based customisation. If your schema uses any of these features, Ajv will handle them and this validator will not. Additionally, Ajv in coerce mode converts types before validating; this tool validates against the raw parsed JSON types without coercion.
Also known as
JSON Schema validatorvalidate JSON schemaJSON schema checkJSON schema testerajv online