Skip to main content

JSON Schema validator

Compare a JSON document with a schema directly in your browser. Each error includes its path, the failed rule and a clear explanation.

Embed this widget

Customize the result, check the live preview, then copy the code.

Preview

Embed code type

Code to copy

Responsive and automatically resized by Bethemesh.

Was this tool useful?

How does this tool work?

Check JSON data against supported schema constraints and locate failures using their path and keyword. The first field holds data, the second its schema; valid JSON in both fields does not imply compliance with the contract. Checks stay local and do not retrieve remote schemas. This implementation covers an explicit subset of JSON Schema 2020-12 rather than claiming complete support for every extension.

Supported checks include type, const, enum, numeric bounds and multipleOf. Strings use minLength, maxLength and pattern. Arrays can use minItems, maxItems, uniqueItems and a single items schema. Objects support properties, required, additionalProperties, minProperties and maxProperties. Combinations allOf, anyOf, oneOf and not are evaluated too.

The whole schema is inspected before data, including currently unused branches. Malformed supported constraints generate schema errors. References $ref and $dynamicRef, prefixItems, contains, patternProperties, conditional dependencies, unevaluated constraints and if/then/else are not implemented. Their presence produces an unsupported-feature diagnostic instead of misleading success.

format does not validate email addresses, URLs or dates in this engine. Annotations such as title and description do not assert value constraints. If your schema needs additional vocabularies or functions, choose a suitable validator rather than removing rules just to obtain a positive result.

String length counts Unicode code points, not UTF-16 units or visual combined characters. Equality for const, enum and uniqueItems ignores object property order but retains array order and scalar types. Numbers remain subject to JavaScript precision; very large values and decimal calculations need appropriate handling in your application.

How to use this tool

  1. Separate data from schema

    Paste values into the JSON document field and rules into the schema field. The sample button demonstrates the separation without contacting an external service.

  2. Run and inspect diagnostics

    Read the summary, then each row’s path and keyword. A path beginning with $schema identifies a problem in the contract definition.

  3. Correct the appropriate input

    Fix incorrect data or a wrongly defined schema rule. Editing either field hides previous results; run validation again before drawing conclusions.

Use cases

Check required fields

Define a small contract with required and properties, then compare API responses. A field present with null may need a nullable type; it is not simply missing.

Check structurally unique array entries

Use uniqueItems to detect equivalent objects even when their properties appear in different written orders.

Diagnose incompatible constraints

Distinguish data errors from invalid schemas and unsupported keywords. In the latter cases, the complete contract has not been checked.

Examples

Count an emoji as one code point

This block presents both inputs together: place document in the first field and schema in the second. The engine summary confirms that 😀 satisfies length 1 through 1.

Input

{
  "document": "😀",
  "schema": {
    "type": "string",
    "minLength": 1,
    "maxLength": 1
  }
}

Result

{
  "valid": true,
  "issues": []
}

Distinguish a string from an integer

id contains the string "1" while the schema requires integer. The summary reports type at $.id. Validation does not automatically convert the value into a number.

Input

{
  "document": {
    "id": "1"
  },
  "schema": {
    "type": "object",
    "required": [
      "id"
    ],
    "properties": {
      "id": {
        "type": "integer"
      }
    },
    "additionalProperties": false
  }
}

Result

{
  "valid": false,
  "issues": [
    {
      "path": "$.id",
      "keyword": "type"
    }
  ]
}

Tips and best practices

  • Include deliberately invalid data to confirm that every relevant rule is actually applied.
  • Retain rules your contract needs. Change validators when a feature is unsupported rather than weakening the schema.
  • Missing fields and null values need separate checks: required checks a key; type checks its value.
  • Schema validation does not check authorization, resource existence or other server rules.

Sources and references

Frequently asked questions

Are $ref references resolved?

No. Neither local nor remote references are evaluated. They produce an explicit diagnostic, without loading schema files or URLs.

Why does format: email accept an arbitrary string?

This engine does not treat format as a validation assertion. Use supported constraints or a validator providing the format vocabulary required by your contract.

How does minLength count an emoji?

An emoji consisting of one code point, such as 😀, counts as one. Modifiers, combining marks and joiner sequences may count as several code points despite appearing as one visual character.

Why are differently written objects considered equal?

Property order does not change a JSON object’s value. const, enum and uniqueItems use structural equality. Array element order remains significant.

Related tools

Tools similar or complementary to this one.

Similar tools

Generate a JSON Schema from a JSON example locally in your browser.

DevelopmentUse this tool

Format, minify, and validate JSON to make it easier to read or more compact.

DevelopmentFeaturedUse this tool