JSON Schema Validator — Validate JSON Online

Paste a JSON Schema and a JSON document and validate the document against it — every violation is reported with its exact path and the rule it broke.

About this tool

What This Validator Checks

The instance is checked against every applicable keyword in your schema, recursively through nested objects and arrays: type, required, properties, additionalProperties, items, enum, const, pattern, numeric bounds (minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf), string bounds (minLength, maxLength), array bounds (minItems, maxItems, uniqueItems), object bounds (minProperties, maxProperties), format, and composition keywords (allOf, anyOf, oneOf, not). Each failure is reported with the path where it occurred, written with dots for keys and brackets for array indexes, such as items[2].sku.

How to Use the JSON Schema Validator Online

  1. Paste your schema into the JSON Schema panel on the left.
  2. Paste the document you want to check into the JSON Instance panel on the right.
  3. Results update as you type; the Validate button re-runs the check. If either panel is not valid JSON, the message says which one failed to parse.
  4. Fix the instance (or the schema) until the green "Valid" message appears.

Worked Examples

1. The sample loaded on this page

The starter schema requires a non-negative integer age and at least one role, while the instance has "age": -1 and an empty roles array. The result is two rows:

error  age    value below minimum 0
error  roles  array shorter than minItems 1

email is not reported because it is optional: it is listed in properties but not in required.

2. An order with nested items

Schema:

{
  "type": "object",
  "required": ["id", "items"],
  "properties": {
    "id": { "type": "string", "pattern": "^ord_[0-9]+$" },
    "status": { "enum": ["paid", "pending", "refunded"] },
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["sku", "qty"],
        "properties": {
          "sku": { "type": "string" },
          "qty": { "type": "integer", "minimum": 1 }
        }
      }
    }
  }
}

Instance:

{
  "id": "ORD-17",
  "status": "shipped",
  "items": [
    { "sku": "A1", "qty": 2 },
    { "sku": "B2", "qty": 0 },
    { "qty": 1 }
  ]
}

Errors:

error  id          does not match pattern ^ord_[0-9]+$
error  status      value must be one of ["paid","pending","refunded"]
error  items[1].qty  value below minimum 1
error  items[2].sku  required property missing

Every violation is listed, not just the first, so you can fix the whole payload in one pass. Patterns are not anchored automatically, which is why ^ and $ appear in the regular expression.

3. Wrong type and format

Validating { "email": "ada.example.com", "age": "37" } against a schema with "format": "email" on email and "type": "integer" on age gives:

error  email  does not match format "email"
error  age    expected type "integer", got "string"

When a value has the wrong type, the remaining checks for that value are skipped, so fix the type first and validate again.

Limits and Edge Cases

This is a lightweight validator for the keywords listed above. $ref, definitions/$defs, if/then/else, patternProperties, dependencies, propertyNames, contains and tuple-style items arrays are ignored rather than rejected, so a schema that relies on them can report "Valid" too easily. A number such as 2.0 counts as an integer, as the specification allows. For anyOf and oneOf you get one summary line (for example "matched 2 schemas in oneOf, expected exactly 1") rather than the reasons each branch failed.

Related Tools

Do not have a schema yet? Generate a first draft from a sample payload with the JSON Schema generator. If the instance will not parse at all, the JSON validator shows the exact line and column of the syntax error. Test a tricky pattern in the regex tester before putting it in a schema.

FAQ

Frequently Asked Questions

Which JSON Schema draft does this support?

The core Draft-07 validation keywords: type, required, properties, additionalProperties, items, enum, const, pattern, minimum/maximum, exclusiveMinimum/exclusiveMaximum, multipleOf, minLength/maxLength, minItems/maxItems, uniqueItems, minProperties/maxProperties, format, and allOf/anyOf/oneOf/not. The $schema value is not read, so the same keywords are applied whichever draft you declare.

Does it support $ref and definitions?

No. $ref, definitions and $defs are not resolved, and any keyword the validator does not know is ignored. Inline referenced subschemas before validating here, or use a full validator such as Ajv for schemas built from references.

What does each error mean?

Each row shows the location of the failing value and the rule it broke. Paths use dots for keys and brackets for array indexes, so items[1].qty with "value below minimum 1" means the qty of the second item is less than the schema minimum. (root) means the whole document.

Why does my JSON pass when I expected an error?

Usually one of three reasons: the keyword is not supported (for example if/then or patternProperties), the property is listed in properties but not in required so its absence is allowed, or the format name is one the validator does not check.

Which formats are checked?

email, uri, uuid, date and date-time, using simple pattern checks. Other format names are accepted without checking.

Is my JSON or schema uploaded anywhere?

No. Validation runs entirely in your browser with JavaScript; nothing is sent to a server.

Related Tools

More Dev Tools

JSON Diff CheckerJSONPath TesterJSON to TypeScriptCSV ⇄ JSONYAML ⇄ JSONRegex Tester

Learn how schemas validate types and required fields in the JSON Schema Validator Guide.