JSON Schema Validator
100% LocalValidate JSON data against a JSON Schema with detailed field-level error reporting.
Paste JSON data and a JSON Schema. Validation runs against the draft-2020-12 spec with error pointers.
Learn More
What is JSON Schema Validator?
Frequently Asked Questions
Technical Deep Dive
JSON Schema Validator
Validate any JSON document against a JSON Schema. Supports type checking, required fields, string patterns & length, number min/max, array item validation, enum, additionalProperties, allOf, anyOf, and oneOf combiners. All validation is done client-side. Shows field-level error paths so you can quickly pinpoint issues.
A 200 response can still be the wrong shape. This page runs the instance against a JSON Schema the way ajv would, without npm.
Schema {"type":"object","required":["id"]} against {"name":"x"} must fail on id. Adding "id": 1 should pass.
Draft mismatches (draft-07 vs 2020-12) are the usual “it works in CI but not here” cause. Check the $schema URI.
Validating JSON Against a Schema: What, Why, and How
JSON Schema turns ad-hoc validation ("if data.user.email exists and looks like an email, and data.user.age is a number...") into a declarative document that any validator can enforce. This validator runs the same checks the big libraries (Ajv, jsonschema, network-nt/json-schema-validator) do, in the same way, but locally in your browser, perfect for debugging API contracts, configuration files, or webhook payloads without ever leaving the page.
What Schema Validation Actually Checks
For each node in your data, the validator evaluates every applicable assertion in the schema:
- Types. Is this a string? A number? An object? A null? Type mismatches are the most common failure.
- Constraints on primitives.
minLength,maxLength,patternfor strings.minimum,maximum,exclusiveMinimum,exclusiveMaximum,multipleOffor numbers.formatfor both. - Constraints on objects.
required(list of mandatory keys),properties(subschemas per key),additionalProperties(allow/disallow unknown keys),patternProperties(regex-keyed subschemas),dependencies. - Constraints on arrays.
items(subschema for every element),minItems,maxItems,uniqueItems,contains. - Combinators.
allOf(every subschema must pass),anyOf(at least one must pass),oneOf(exactly one must pass),not(the subschema must fail). - Enums and constants.
enum(value must be one of),const(must equal exactly this).
The validator runs every applicable assertion and accumulates errors rather than failing on the first one. You see the full set of problems in one pass.
Error Output That Pinpoints the Problem
Generic validators report "validation failed" and leave you to find where. Good validators report exact paths. This validator reports each error as:
For deeply nested schemas, this is the difference between five minutes of bisecting and instant comprehension.
Combinator Errors: The Hard Part
oneOf and anyOf are the most expressive, and the most confusing, schema constructs. A discriminated union like:
When this fails, naive validators report "does not match any schema". This validator reports per-branch failures, so you see "branch 0 failed because userId is missing; branch 1 failed because systemKey is missing", which immediately tells you which intent the data was closest to.
For schemas using a discriminator pattern (type field selecting which branch applies), consider using if/then/else instead of oneOf, error messages are dramatically clearer.
Refs and Modular Schemas
Real schemas reuse subschemas heavily via $ref. The validator resolves all local refs (those pointing into the same document, like #/definitions/Address) automatically. Remote refs (URLs to other files) are blocked for security in the browser context, bundle them with a tool like json-schema-ref-parser before pasting if your schema relies on external files.
Validating at API Boundaries
The highest-value use of JSON Schema is at runtime, in production, as a defensive layer at API ingress and egress:
- Incoming requests, reject malformed payloads at the gateway with a precise error message instead of relying on each handler to validate.
- Outgoing responses, in integration tests, validate against the schema you publish to clients. Catches contract drift before it ships.
- Webhook events, schema-validate every inbound webhook; a small format change at the sender shouldn't take down your processor.
- Configuration files, validate Kubernetes ConfigMaps, Helm values, and service configs at deploy time.
This browser-side validator is for the debugging path, when something failed and you need to know exactly why. Once you're satisfied with the schema, port the same JSON to your runtime validator (Ajv in Node, jsonschema in Python, networknt in Java) and the behavior will match.
Schema Versioning
Schemas evolve, and consumers don't all upgrade in lockstep. Best practices:
- Use $id to version your schemas:
https://example.com/schemas/user-v3.json. - Never silently break a contract. Adding optional fields is safe; making a previously optional field required is breaking.
- Stamp data with the schema version it was produced against. Future processors can validate against the right version.
Privacy and Trust
A schema can reveal sensitive API surface; data can include PII. Both stay in your browser when you use this validator. You can confidently paste production payloads to debug a failed validation without crossing any data-residency or compliance boundaries.
03 Where Schema Validation Pays Back
JSON Schema (draft 2020-12 is the current spec) earns its keep wherever an unverified payload could quietly poison downstream systems. These are the scenarios where teams that adopt schema validation usually see the highest ROI.
-
REST API request validation at the edge Validate incoming POST/PUT bodies at the API gateway with Ajv (Node) or python-jsonschema. A typo'd field name or wrong type is rejected with a precise pointer before it ever reaches business logic, turning a class of "why is this field
undefined?" bugs into 400 responses with actionable error paths. -
OpenAPI 3.1 spec testing OpenAPI 3.1 aligns with JSON Schema 2020-12. Validate sample request/response payloads against the spec's schemas in your contract tests; the moment a server starts returning a payload that violates its own schema, the build breaks instead of a downstream consumer.
-
Boot-time config validation (the Stripe approach) Validate the entire service config against a schema at process startup, before any traffic is accepted. If a required field is missing or a URL is malformed, the process refuses to come up, way better than discovering it via a 3 AM page when the first request hits the bad code path.
-
CI gate on data contracts Run schema checks on every PR that touches API or message-format code. Combined with schema versioning (
$id), this catches breaking changes before they merge, a missing-required-field bug never makes it past code review. -
Inbound webhook hardening Third-party webhooks (Stripe, GitHub, Shopify) evolve. A schema check at the webhook intake gives you an explicit, loud failure when a sender adds or renames a field, much easier to triage than a silent
NoneTypedeep in a handler.
04 Worked Examples
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"required": ["userId", "amount", "currency"],
"properties": {
"userId": {"type": "string", "pattern": "^u_[A-Za-z0-9]+$"},
"amount": {"type": "integer", "minimum": 1},
"currency": {"type": "string", "enum": ["USD","EUR","GBP"]}
}
}
{"userId":"u_8a2f","amount":1299}FAIL required path: "" missing "currency"Without validation this charges in some default currency or throws a generic 500 later. With validation, the gateway returns 400 with the field name. This is the highest-ROI thing JSON Schema does.
{
"type": "object",
"properties": {"eventName": {"type": "string"}, "userId": {"type": "string"}},
"additionalProperties": false
}{"eventNmae":"checkout_completed","userId":"u_8a2f"}FAIL additionalProperties path: "" unexpected key "eventNmae"Without additionalProperties: false, the typo is silently accepted, eventName ends up undefined, and analytics quietly attribute the event to "unknown". With it, the typo is rejected loudly. This is the single biggest reason to enable strict mode in analytics intake.
oneOf:{
"oneOf": [
{"properties":{"type":{"const":"payment.succeeded"},"chargeId":{"type":"string"}},
"required":["type","chargeId"]},
{"properties":{"type":{"const":"payment.refunded"},"refundId":{"type":"string"}},
"required":["type","refundId"]}
]
}{"type":"payment.succeeded"}:FAIL oneOf branch 0: required → missing "chargeId"
branch 1: const → "type" must be "payment.refunded"Branch 0 nearly matched (right type, wrong shape), a clear signal that the sender meant to emit a payment.succeeded but dropped chargeId. For routing-style unions, draft 2020-12's if/then/else often produces even cleaner messages than oneOf.
05 Related Tools
Schema validation is the safety net under a larger contract-first workflow. These tools live next door.
OpenAPI Validator
OpenAPI 3.1 schemas are JSON Schema 2020-12. Validate full API specs (paths, operations, components) rather than a single schema in isolation.
JSON to Zod
For TypeScript projects, port your JSON Schema validation idea over to a Zod runtime schema so you get a TS type and runtime guard from one declaration.
JSON Formatter
Pretty-print the failing payload before pasting it into the validator, JSONPath error pointers are far easier to follow on formatted input.