JSON Schema Validator
Validate JSON against a JSON Schema (Draft 2020-12) and get errors with full instance paths
JSON
Schema
JSON Schema Validator
Validate JSON against a JSON Schema (Draft 2020-12) and get errors with full instance paths
Features
- Validates JSON instances against any JSON Schema using Ajv (the de-facto reference implementation), with full support for Draft-07, 2019-09, and 2020-12 keywords
- Error report lists every failure as `path: message` — instance paths follow RFC 6901 JSON Pointer notation so you can drill straight to the offending node in nested data
- All errors are reported in a single pass (allErrors: true) instead of stopping at the first failure — see every issue at once
- Strict-mode compilation disabled so non-standard or extended schemas still compile; allowUnionTypes turned on for schemas that use union types
- Load Sample button fills both panes with a tiny example (object with required id and name plus a tags array) so you can see the validator working without typing
- Copy Errors button emits the full error list as a newline-separated `path: message` block — paste straight into a ticket or test fixture
- Pure client-side: Ajv runs in your browser, no JSON or schema is uploaded to any server, and the tool works offline after the page loads
- Separate parse-error reporting distinguishes JSON-malformed input from schema-violation failures — you always know whether to fix syntax or contract
How to use
- Paste the JSON instance you want to validate into the left textarea.
- Paste your JSON Schema into the right textarea — use Draft 2020-12, 2019-09, or Draft-07; Ajv autoselects by $schema.
- Click Validate. If both inputs parse cleanly, Ajv compiles the schema and runs the validation.
- Read the result: a green Valid banner means the instance matches; otherwise each failure shows the JSON Pointer path and the human-readable Ajv message.
- Click Copy errors to grab the full report as `path: message` lines for sharing or storing in a fixture file.
- Use Load Sample to populate both panes with a working example if you want to verify behaviour before pasting your own data.
Tips & Best Practices
- Always include a $schema field in your schema so Ajv picks the correct draft semantics.
- Prefer additionalProperties: false during development to catch typos in field names early.
- Use $defs (or definitions on Draft-07) to share common subschemas — refs make schemas DRY and reviewable.
- When validation passes locally but fails in CI, check that the same Ajv version and drafts are used in both environments.
- Save the Copy errors output into your test fixtures so regressions surface as schema-violation diffs.
FAQ
Which JSON Schema drafts are supported?
Draft-07, Draft 2019-09, and Draft 2020-12. Ajv autoselects the meta-schema based on your schema's $schema field; if omitted, it falls back to Draft-07 semantics. The newer 2020-12 spec replaces definitions with $defs and items with prefixItems/items — both old and new keywords are accepted.
What does the path in an error mean?
Ajv reports instancePath in RFC 6901 JSON Pointer notation: '/users/0/email' means 'the email property of the first user'. The root is the empty string (rendered as $ in the UI). This makes it easy to navigate back to the failing field in nested data.
Why doesn't my schema compile?
Common causes: malformed JSON (extra commas, single quotes, unquoted keys); a $ref pointing to a definition that doesn't exist; or a keyword used in strict mode that Ajv doesn't recognise. The schema parse-error panel shows Ajv's exact compile error; strict mode is already disabled here so most non-standard schemas should still compile.
Why am I getting a 'unknown keyword' or 'unknown format' error?
JSON Schema standard keywords (type, required, properties, etc.) are built in. Custom format names like 'date-time', 'uri', 'email' aren't validated by default — Ajv treats them as annotations unless you load ajv-formats. If you need formats checked, run validation in a build step with ajv-formats installed.
Does the validator stop at the first error?
No. Ajv is configured with allErrors: true, so every failure is reported. For deeply nested errors this can be verbose; if you only want the first one, hand the JSON+schema to your own ajv() call with allErrors: false in your build.
Does this work for very large JSON documents?
Yes, but compile-once-validate-many is the right pattern in code. This tool re-compiles on every Validate click, which is fine for development-time checks but not for production hot paths. The Ajv build used here is the standard ESM bundle; expect millisecond compile times for typical schemas.
Are my JSON and schema sent anywhere?
No. Both textareas stay in your browser; Ajv runs locally; we don't log, store, or telemeter the content. You can verify in the DevTools Network tab — there's no network call when you press Validate.
What's the difference between this and the schema tab in JSON Formatter?
JSON Formatter's schema tab uses the same Ajv-backed SchemaService for one-off checks alongside formatting, JSONPath, and tree view. This standalone validator gives you two big paste panes, a sample loader, copy-errors export, and a single dedicated URL to bookmark or share — better when validation is your only task.