nrtechstudio.com

JSON Schema Validator — Free Online JSON Schema Tester, Checker & Playground

Paste a JSON document and a JSON Schema to test validity instantly. Get precise error paths (JSON Pointer, e.g. $.users[2].email) — not a bare "invalid". Supports draft 2020-12, 2019-09 and Draft-07, $ref, format assertions, and YAML schemas.

🔒 100% client-side & offline. This page is one self-contained file with zero network requests — your schema and data never leave your browser. It works offline and nothing is uploaded, logged, or tracked.

JSON Schema

JSON document

Type or paste a schema and a JSON document, then validate.

On this page:

What is a JSON Schema validator — and what is it used for?

A JSON Schema validator checks whether a JSON document conforms to a JSON Schema: a declarative contract describing the allowed structure, data types, required fields, value ranges, string patterns, and formats. Think of it as "TypeScript types for JSON data at runtime".

Common uses:

JSON validator vs JSON Schema validator: a plain JSON validator (or "JSON checker") only verifies syntax — is it well-formed JSON? A JSON Schema validator goes further and verifies semantics against your schema: right types, required fields present, numbers in range, strings matching patterns, emails that look like emails.

How does JSON Schema validation work?

The validator walks the JSON document and the schema in parallel. For every value it applies the schema keywords that target it:

  1. type checks the value's kind (object, array, string, number, integer, boolean, null).
  2. Object keywords (properties, required, additionalProperties, patternProperties) check each member.
  3. Array keywords (items/prefixItems, minItems, uniqueItems) check each element.
  4. String/number keywords (minLength, pattern, minimum, multipleOf, format) constrain the value itself.
  5. Combinators (allOf, anyOf, oneOf, not, if/then/else) compose schemas.

Every violation is reported with the JSON Pointer path of the failing value — e.g. $.users[2].email — so you know exactly where it broke. Enable Explain mode above and each error is also translated into plain language ("The value at $.age is out of the allowed numeric range: -5 is less than the minimum 0.").

How to use this JSON Schema validator

  1. Paste your schema on the left (JSON, or YAML with "Schema is YAML" checked).
  2. Paste the JSON document to test on the right.
  3. Pick the draft your schema targets (2020-12, 2019-09, or Draft-07).
  4. Validation runs live as you type. Click any error to jump to its exact location in the document.

Try the Sample dropdown, then "Load failing example" to see precise error paths in action. Toggle "Enforce format" off if your schema uses format only as documentation (per spec, format is annotation-only by default; this tool lets you opt into assertion).

JSON Schema data types & core keywords

The six JSON types plus integer: object, array, string, number, integer, boolean, null. Key constraining keywords:

{
  "type": "object",
  "properties": {
    "name":  { "type": "string", "minLength": 1, "maxLength": 80 },
    "code":  { "type": "string", "pattern": "^[A-Z]{2}-\\d{4}$" },
    "price": { "type": "number", "exclusiveMinimum": 0, "multipleOf": 0.01 },
    "tags":  { "type": "array", "items": { "type": "string" },
               "minItems": 1, "uniqueItems": true },
    "role":  { "enum": ["admin", "editor", "viewer"] },
    "kind":  { "const": "user" }
  },
  "required": ["name", "role"],
  "additionalProperties": false
}

oneOf vs anyOf (and allOf / not)

anyOf — at least one

The value must match one or more subschemas. Use for overlapping alternatives.

{"anyOf": [
  {"type": "string"},
  {"type": "string",
   "format": "email"}
]}

"a@b.co" matches both — fine.

oneOf — exactly one

The value must match precisely one subschema. Use for mutually exclusive variants; the validator tells you if zero or several matched.

{"oneOf": [
  {"type": "object",
   "properties": {
     "w": {"type": "number"},
     "h": {"type": "number"}},
   "required": ["w","h"]},
  {"const": "digital"}
]}

allOf requires matching every subschema (great for mixing reusable fragments); not forbids matching a subschema.

$ref, $defs, anchors & recursion

$ref reuses a schema defined elsewhere — no copy-paste. This tool resolves internal references: local JSON Pointers (#/$defs/address), relative refs, plain-name anchors ($anchor), and the draft-specific dynamic keywords $dynamicRef (2020-12) and $recursiveRef (2019-09).

{
  "$defs": {
    "address": {
      "type": "object",
      "properties": {
        "street": { "type": "string" },
        "zip":    { "type": "string", "pattern": "^\\d{5}(-\\d{4})?$" }
      },
      "required": ["street", "zip"]
    }
  },
  "type": "object",
  "properties": {
    "home": { "$ref": "#/$defs/address" },
    "work": { "$ref": "#/$defs/address" }
  }
}

Remote $ref (http/https URLs) is intentionally not fetched — the tool is 100% offline, so there is no network to fetch with. Inline the referenced schema into $defs instead. Circular $refs are handled safely.

additionalProperties — strict schemas

By default, objects may contain properties not listed in properties. Set "additionalProperties": false for a strict schema that rejects unknown keys — the error names the offending property. Use patternProperties when extra keys are allowed but must follow a shape:

{
  "type": "object",
  "properties": { "name": { "type": "string" } },
  "patternProperties": { "^x-": { "type": "string" } },
  "additionalProperties": false
}

Here x-anything keys are allowed (and must be strings); any other undeclared key fails. Draft 2020-12 also offers unevaluatedProperties, which understands allOf/oneOf compositions — both are supported by this validator.

Conditional validation: if / then / else & dependentRequired

For rules like "conditional required" — field B is required only when field A has a certain value — use if/then/else:

{
  "type": "object",
  "properties": {
    "country":    { "type": "string" },
    "postalCode": { "type": "string" }
  },
  "if":   { "properties": { "country": { "const": "USA" } },
            "required": ["country"] },
  "then": { "properties": { "postalCode":
            { "pattern": "^\\d{5}(-\\d{4})?$" } } },
  "else": { "properties": { "postalCode": { "minLength": 3 } } }
}

For simpler co-occurrence ("if credit_card is present, billing_address is required"), dependentRequired: { "credit_card": ["billing_address"] } (2020-12; dependencies in Draft-07) is enough. Try the if/then/else sample above.

Optional fields & nullable types ("string or null")

Properties are optional by default — only names listed in required must appear. To additionally allow an explicit null value (a "string or null" field), widen the type:

{
  "type": "object",
  "properties": {
    "nickname": { "type": ["string", "null"] },
    "email":    { "type": "string", "format": "email" }
  },
  "required": ["email"]
}

{"email": "a@b.co"} is valid (nickname omitted); {"email": "a@b.co", "nickname": null} is valid; {"email": "a@b.co", "nickname": 42} fails.

Nested objects & arrays of objects

Nest properties to any depth; describe each array element with items. Error paths track the full descent — $.orders[0].lines[2].price:

{
  "type": "object",
  "properties": {
    "customer": {
      "type": "object",
      "properties": {
        "name":    { "type": "string" },
        "address": { "$ref": "#/$defs/address" }
      },
      "required": ["name"]
    },
    "orders": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "sku":   { "type": "string", "pattern": "^[A-Z0-9-]+$" },
          "price": { "type": "number", "minimum": 0 }
        },
        "required": ["sku", "price"]
      },
      "minItems": 1
    }
  },
  "required": ["customer", "orders"]
}

Format validators: email, date, URL, UUID & more

With "Enforce format" enabled, string formats are asserted (disable it to treat them as annotations, per the spec default):

FormatExample (valid)Notes
emailada@example.comRFC 5322 dot-atom / quoted-string / domain-literal
date2026-10-06Real calendar dates incl. leap years
time23:59:60ZLeap second only at 23:59:60 UTC
date-time2026-10-06T14:30:00+07:00RFC 3339, timezone required
durationP1Y2M3DT4HISO 8601, strict grammar
uri / uri-referencehttps://example.com/a?b=cRFC 3986 parser (userinfo, pct-encoding, IP literals)
hostname / idn-hostnamemünchen.de (idn)UTS-46 mapping + IDNA2008 checks
ipv4 / ipv6192.168.0.1 / ::1Strict dotted-quad / compressed forms
uuid123e4567-e89b-12d3-a456-426614174000Any version, canonical form
regex^[a-z]+$Must compile as ECMA-262 regex
json-pointer/users/0/emailRFC 6901 syntax

String patterns use the pattern keyword with regex (ECMA-262): { "type": "string", "pattern": "^[a-z0-9-]+$" }.

JSON Schema in YAML — validator & examples

JSON is valid YAML, and schemas are often authored in YAML for readability. Check "Schema is YAML" and paste a YAML schema — mappings, nested blocks, and sequences are converted before validation:

type: object
properties:
  name:
    type: string
    minLength: 1
  email:
    type: string
    format: email
  tags:
    type: array
    items:
      type: string
required:
  - name
  - email
additionalProperties: false

Flow collections (type: [string, "null"]), quoted strings, numbers, booleans, and comments are supported. The instance document stays JSON.

Draft 2020-12 vs 2019-09 vs Draft-07

FeatureDraft-072019-092020-12
Reusable definitionsdefinitions$defs
Dynamic references—$recursiveRef / $recursiveAnchor$dynamicRef / $dynamicAnchor
Array tuple keyworditems (array form)prefixItems
Strict extrasadditionalProperties+ unevaluatedProperties
DependenciesdependenciesdependentRequired / dependentSchemas
Sibling $id + $ref$ref wins (id ignored)$id applies

Pick the draft your schema declares via $schema (the toolbar selector overrides for testing). All three are fully supported, including the tricky bits: outermost-wins $dynamicRef, $recursiveRef scoping, and unevaluated* evaluation tracking.

OpenAPI JSON Schema validation

OpenAPI 3.1 schemas are a dialect of JSON Schema draft 2020-12 — paste them here and they validate directly (including $defs, prefixItems, and const). OpenAPI 3.0 uses an older subset: replace $defs with definitions, rewrite boolean exclusiveMinimum/exclusiveMaximum as numbers, and note that 3.0's nullable: true becomes "type": ["string", "null"].

Custom error messages

JSON Schema has no standard errorMessage keyword (that's an AJV extension). The portable approach: use Explain mode in this tool, which renders every failure as a human sentence with its exact path — or add title/description annotations to document intent for API consumers.

Comparison: this validator vs alternatives

This tooljsonschemavalidator.netextendsclass / codebeautifyAJV (library)
PriceFree, no signupFreeFreeFree (MIT)
Drafts2020-12 · 2019-09 · Draft-07Older draftsVaries / thinAll (separate builds)
Precise error pathsJSON Pointer + click-to-jumpGeneric messagesBasicVia code
Explain mode (plain language)YesNoNoNo
YAML schemasBuilt inNoNoNeeds plugin
Works offline / privateZero network requestsServer round-tripAds + trackingLocal code
Spec-test-suite score99.87% (6032 tests)UnpublishedUnpublished~100%
Fairness note (as of October 2026): this table compares publicly observable features. AJV is the reference library for Node.js — use it when you need validation inside your own code; use this page when you want a no-setup online playground with instant visual feedback. If a competitor adds a feature, tell us and we'll update the table.

Validator vs generator — and related tools

A JSON Schema validator tests documents against a schema; a generator creates a schema from sample JSON (or sample data from a schema). Different intents — this page is the validator. If you need the other direction, nrtechstudio.com also hosts a JSON-to-JSON-Schema generator and a JSON Schema viewer.

Frequently asked questions

What is a JSON Schema validator used for?

A JSON Schema validator checks whether a JSON document conforms to a JSON Schema — a contract describing allowed structure, types, and constraints. It is used to validate API requests and responses, configuration files, and data pipelines before bad data causes failures.

How does JSON Schema validation work?

The validator walks the JSON document and the schema together, applying each keyword (type, properties, required, items, pattern, format, etc.) to the matching value. Every violation is reported with the JSON Pointer path of the failing value, e.g. $.users[2].email.

Which JSON Schema drafts are supported?

Draft 2020-12, draft 2019-09, and Draft-07. Select the draft in the toolbar; keywords like $dynamicRef (2020-12) or $recursiveRef (2019-09) behave per their specification.

Does the validator support $ref?

Yes — internal $refs such as #/$defs/address, relative refs, JSON Pointer fragments, anchors ($anchor), and draft-specific $dynamicRef/$recursiveRef are resolved. Remote $refs over http(s) are not fetched, because the tool works 100% offline; inline the referenced schema instead.

What is the difference between oneOf and anyOf?

anyOf requires the value to match at least one subschema; oneOf requires it to match exactly one. Use anyOf for overlapping alternatives and oneOf for mutually exclusive variants.

How do I make a field optional in JSON Schema?

Fields are optional by default — only properties listed in required must be present. To allow an explicit null, use "type": ["string", "null"].

How do I validate a nested object or an array of objects?

Describe nested objects with properties inside properties, and arrays of objects with "items": { "type": "object", "properties": {...} }. Errors include the full path, e.g. $.orders[0].price.

What formats can be validated (email, date, URL, UUID)?

With format enforcement enabled: email, date, time, date-time, duration, uri, uri-reference, uri-template, hostname, idn-hostname, ipv4, ipv6, uuid, regex, and json-pointer.

Can I write the schema in YAML?

Yes. Enable YAML mode and paste a YAML schema (mappings, sequences, nested blocks); it is converted to JSON before validation. JSON itself is also valid YAML.

Does the validator work offline?

Yes. The page is a single self-contained file with zero network requests — validation runs entirely in your browser, so it works offline and your data never leaves your device.

What is the difference between a JSON validator and a JSON Schema validator?

A JSON validator only checks syntax (is it well-formed JSON?). A JSON Schema validator additionally checks semantics against a schema: correct types, required fields, value ranges, patterns, and formats.

Can I validate OpenAPI schemas with this tool?

OpenAPI 3.1 schemas are a dialect of JSON Schema draft 2020-12 and validate directly. OpenAPI 3.0 uses an older subset (no $defs, boolean exclusiveMinimum); convert or adjust those keywords first.

How do conditional requirements (if/then/else) work?

if tests a condition schema; when it matches, then must also validate, otherwise else applies — e.g. "if country is USA then postalCode must match a US ZIP pattern".

Is this JSON Schema validator free?

Yes — free, no signup, no usage limits, no data uploaded. The validation engine passes 99.87% of the official JSON-Schema-Test-Suite (6032 tests).

How accurate is this validator?

The engine is verified against the public JSON-Schema-Test-Suite: 6024 of 6032 tests pass (99.87%). The remaining failures are remote $refs (not fetched, by design — the tool is offline) and custom-vocabulary meta-validation.

Free tool by NRTechStudio