Skip to main content
KalkuNet

JSON Schema Validator — Draft 2020-12 and Draft-07, Errors by Path

Verify JSON objects against required fields, primitive types & pattern rules.

Runs in your browserDeveloper · JSON, YAML, TOML, XML & CSV Converters
Draft:

✗ Invalid under Draft 2020-12: 5 errors

  • /port · maximum · Must be ≤ 65535
  • /env · enum · "production" is not one of the enum values
  • /tags · uniqueItems · Items are not unique
  • /timeoutMs · multipleOf · Must be a multiple of 0.5
  • (root) · additionalProperties · Additional properties are not allowed: vlan
  • /hostname: Not a valid ipv4
  • format (email, ipv4, date, …) is an annotation in both drafts, so it only raises a warning. Local $ref (#/..., #, anchors) is supported; references to other URLs are not fetched.

When to use the JSON Schema Draft-07 / 2020-12 Validator

  • Two drafts

    The draft is read from $schema or picked by hand, and the differences are honoured: in Draft-07 $ref replaces its sibling keywords and items may be an array, while 2020-12 uses prefixItems, dependentRequired and minContains.

  • One error per failing keyword

    Each error lists the data path as a JSON Pointer such as /endpoints/0/port, the failing keyword and an explanation, reported the same way as Python's jsonschema library.

  • Numbers compared exactly

    minimum, maximum and multipleOf use exact decimals, so 0.3 is a multiple of 0.1 and big integers are not rounded. 1.0 counts as an integer, as the specification says.

  • Local references

    $ref to #/$defs, #/definitions, any JSON Pointer inside the schema and $anchor are supported, including recursive schemas such as trees.

Frequently asked questions

Why does additionalProperties not reject my property?

additionalProperties only looks at properties and patternProperties in the same schema, not at schemas inside allOf. For combined schemas, use unevaluatedProperties in 2020-12.

Are $ref URLs to other files fetched?

No. Only references inside the same schema are used; others are reported so you know which part was skipped.

Why does anyOf give only one error?

Because the failure is that no subschema matches. Validate against each subschema on its own to see the detailed reasons.

Is my data sent to a server?

No. The schema and data are validated in your browser.

How do Draft-07 and 2020-12 differ in practice?

2020-12 schemas use $defs, prefixItems and dependentRequired, while Draft-07 uses definitions, array-form items, additionalItems and dependencies. The same schema can give different results under the wrong draft, so put $schema at the top.

Learn more