JSON Schema Validator

Validate a JSON document against a JSON Schema (Draft 07 and 2020-12). Powered by Ajv with ajv-formats — the de facto standard. Detailed error paths and messages. Runs in your browser; data never leaves your machine.

Developer Tools
ProDentim Sponsored
JSON Schema
JSON document to validate

What this tool does

Paste a JSON Schema on the left and a JSON document on the right. The tool reports whether the document conforms to the schema, and if not, lists every error with a path showing where it occurred. Validation runs entirely in your browser using Ajv (the fastest JavaScript validator and the de facto standard), loaded from CDN. Your data never leaves the page.

JSON Schema Validator is the natural pair of the JSON Schema Generator. Generate a draft from real data, edit it to tighten the rules (mark some fields optional, add enums and ranges), then use this tool to confirm that your historical data still validates. The two tools together give you a complete round-trip workflow for adding runtime validation to an untyped JSON contract.

Why runtime validation matters

Static types (TypeScript, Flow, mypy) only check your own code. The moment data crosses a boundary — an HTTP request body, a database row, a file you didn't write — your types are aspirations, not facts. JSON Schema validation enforces the rules at runtime, in the exact place where you can still do something useful (return a 400, log a clear error, fall back to a default).

A common pattern: validate request bodies at the API boundary, validate config files at startup, validate webhook payloads before persisting. The cost is microseconds per validation (Ajv compiles schemas to JavaScript functions); the benefit is catching every malformed payload at the right layer.

Reading validation error output

Each error includes four useful fields:

  • instancePath — JSON Pointer to where the error occurred in your data, e.g. /users/0/email.
  • schemaPath — JSON Pointer to the schema rule that failed, e.g. #/properties/users/items/properties/email/format. Useful when the same rule applies in multiple places.
  • keyword — which constraint failed: type, required, format, enum, minimum, etc.
  • message — a short human description like "must match format \"email\"".

Format validation — opt-in

The format keyword is advisory by default in JSON Schema. With "validate format" enabled, this tool uses Ajv's ajv-formats add-on to actually enforce email, uri, date-time, uuid, ipv4, and others. Disable it if you want to match validators that treat format as documentation-only.

In your own code with Ajv: const ajv = new Ajv(); require('ajv-formats')(ajv);. In Python's jsonschema library: pass format_checker=Draft7Validator.FORMAT_CHECKER when validating.

Common errors and what they mean

  • must have required property 'x' — a field listed in required is missing. Either add it to the data or remove it from the required array if it's actually optional.
  • must be string / must be number / must be object — wrong type. Check whether the source data sends numeric IDs as strings (Twitter snowflakes do this), or whether your schema is wrong about a field.
  • must match format "email" — a string didn't match the format regex. Common culprit: missing TLD, leading/trailing whitespace, or the format being too strict (the email format in Ajv is fairly permissive but not RFC-compliant in every edge case).
  • must NOT have additional properties — the schema has additionalProperties: false and your data has a key not listed in properties. Either add the key to the schema or relax the constraint.
  • must be equal to one of the allowed values — failed an enum constraint. Check spelling and case.
  • must NOT be valid — a not constraint matched something it shouldn't. The most confusing error type; usually a schema-design problem.
ProDentim Sponsored

Common use cases

Frequently asked questions

Which JSON Schema drafts are supported?

The tool uses Ajv 8 which supports Draft 06, 07, 2019-09, and 2020-12. The schema's <code>$schema</code> property determines which draft's rules apply; Ajv auto-detects.

Why are formats not enforced by default?

The JSON Schema spec says <code>format</code> is advisory unless the validator opts in. Toggle "validate format" to enable Ajv's format checking (email, uri, uuid, ipv4, date-time, etc.). Without this toggle, formats are documentation.

Can I use $refs to other schemas?

Internal refs (<code>$ref: "#/$defs/foo"</code>) work. External refs (<code>$ref: "https://example.com/schema.json"</code>) require the referenced schema to be loaded — not supported in this browser-based tool. For multi-file schemas, use Ajv locally.

What does "must NOT have additional properties" mean?

Your schema has <code>"additionalProperties": false</code> and the data contains a key not listed in <code>properties</code>. Either remove the key from data, add it to properties, or relax to <code>"additionalProperties": true</code>.

Related tools