HomeValidatorsDataJSON 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.

Reviewed by the thecalcu.com team · Last updated June 28, 2026

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.

Why Use a JSON Schema Validator?

Writing a schema is a contract. A schema says: "every document in this system must look exactly like this." Enforcing that contract without tooling means writing bespoke type-checking code that drifts from the spec over time and misses edge cases. JSON Schema externalises that contract into a declarative document that any standards-compliant validator can check.

Common situations where this tool saves time:

  • You are building an API and want to verify that a sample request body satisfies the schema before writing the server-side handler.
  • You are integrating with a third-party API and want to confirm that the response you received matches the documented schema.
  • You are editing a JSON configuration file for a tool (webpack, ESLint, GitHub Actions) that ships a JSON Schema and want to know whether your edits are valid before running the tool.
  • You are debugging a production error and want to replay the failing payload against the schema to identify which field caused the rejection.
  • You are documenting an API and want to verify that every example in the documentation actually passes schema validation.

The error paths in the output use dot notation, root.address.postcode rather than a raw JSON Pointer, so errors are readable without understanding the JSON Pointer specification.

Who Should Use This Validator?

Backend developers designing or consuming REST and GraphQL APIs. JSON Schema is the foundation of OpenAPI request/response validation, checking a payload against the relevant schema fragment is the fastest way to reproduce a 400 Bad Request without spinning up the full application.

Frontend developers validating form submission payloads before they reach the API. If the API publishes a schema for its endpoints, this tool lets you test sample payloads directly.

DevOps and platform engineers working with JSON-format infrastructure configuration (AWS CloudFormation, Terraform variable files, Kubernetes CRDs exported as JSON). Many of these tools publish JSON Schemas; validating configs against them before deployment catches structural errors before they cause a pipeline failure.

API integration engineers receiving webhooks or third-party data feeds. Pasting an incoming payload against the documented schema confirms the external system is sending data in the expected shape, and when it is not, the error paths identify exactly which fields deviate.

QA and test engineers building regression test suites. Storing the schema alongside expected-response fixtures and validating them here confirms that fixture files stay in sync with the schema as both evolve.

For full OpenAPI spec validation, checking the spec document itself, not individual request bodies, use the OpenAPI Validator.

What Insights Does the JSON Schema Validator Give You?

When validation passes, the tool shows a green Valid badge and confirms that all type, required-field, and constraint checks passed. This means every property listed in required was present, every type assertion matched the actual value type, and every constraint keyword (minimum, maxLength, pattern, and so on) was satisfied.

When validation fails, the tool shows a red Invalid badge, a summary count of errors found, and a list of individual errors, up to 20, to avoid overwhelming the output for severely malformed data. Each error includes:

  • The dot-notation path to the failing value (e.g. root.user.age)
  • What was expected (e.g. expected type "number")
  • What was found (e.g. got "string")
  • For constraint failures, the specific constraint and the actual value (e.g. 14 < minimum 18)

The validator also catches schema-level issues separately: if the Schema textarea contains invalid JSON, it reports "Schema is not valid JSON" before attempting any validation. If the Data textarea contains invalid JSON, it reports "JSON data is not valid JSON." This distinction matters because a schema parse failure and a validation failure are two different problems requiring different fixes.

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.

Show formula & methodology ↓Show less ↑

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

What is JSON Schema?
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.
What is JSON Schema Draft-07?
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.
Which JSON Schema keywords does this validator support?
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.
Does this validator support $ref or $defs?
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.
Does this validator support the `format` keyword?
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.
Is my JSON data uploaded to a server?
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.
How do I read the error paths in the output?
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.
How do I validate that a JSON document has no extra properties beyond those defined in the schema?
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`.
What is the difference between allOf, anyOf, and oneOf?
`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.
How is this different from validating JSON syntax with the JSON Validator?
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.
Can I use this to validate OpenAPI request and response bodies?
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.
Why does my schema validate locally with Ajv but produce different results here?
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