Skip to content
4all.tools

Validate JSON with a JSON Schema

Check a strict JSON document against a local, explicitly limited subset of JSON Schema draft-07.

Tool workspace

Validate a JSON document against a schema

JavaScript is required to run this local validation tool.

Enter one JSON object using the supported draft-07 subset.

0 / 100,000 UTF-16 code units

Enter the JSON document to validate against the schema.

0 / 250,000 UTF-16 code units

Validation runs locally in your browser. Neither input is sent to a server.

Validation actions

Enter a schema and a JSON document, then choose Validate.

Supported keywords, references, and limits

About this validator

This tool accepts JSON object schemas that declare http://json-schema.org/draft-07/schema#. It implements a subset of draft-07.

Supported keywords

$schema, title, description, type, properties, required, items, additionalProperties, enum, const, minimum, maximum, exclusiveMinimum, exclusiveMaximum, minLength, maxLength, and pattern.

Unsupported keywords

Other keywords are rejected, including $ref, definitions, format, allOf, anyOf, oneOf, not, dependencies, and conditional keywords.

Patterns use a restricted grammar: ASCII letters and digits, escaped regex punctuation, simple character classes, start/end anchors, and at most one ? or bounded {min,max} quantifier (max 32).

Schemas are never downloaded. Remote references such as $ref are not followed and are unsupported.

Resource limits

Schema: 100,000 UTF-16 code units; parser depth 60, 5,000 nodes, 1,000,000 parser work units, and 100 diagnostics. Preflight allows 5,000 structural visits, depth 40, 5,000 names, 50 patterns up to 128 code units each, and 100 enum members.

Document: 250,000 UTF-16 code units; parser depth 100, 25,000 nodes, 1,000,000 parser work units, and 100 diagnostics. A string checked by pattern is limited to 10,000 code units.

The full validation has 5,000,000 work units, 8,192 variable diagnostic code units, and an 8 second time limit. Limits cannot be raised in the interface.

Validate a document with a schema

Enter one JSON Schema object in JSON Schema and the JSON value to check in JSON document, then choose Validate. The validator first parses both inputs as strict JSON, checks the complete schema, and then evaluates the document. It reports the first error; this initial version does not list every mismatch. A successful result means the document is valid for this tool’s supported subset, not for every feature in draft-07.

Choose Load example to fill both editors with this working pair. The example can be edited and is not validated until you choose Validate.

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "properties": {
    "name": { "type": "string", "minLength": 1 },
    "active": { "type": "boolean" }
  },
  "required": ["name"],
  "additionalProperties": false
}
{
  "name": "Ada",
  "active": true
}

Supported draft-07 subset

The root schema must be a JSON object and must declare the exact http://json-schema.org/draft-07/schema# value in $schema. The validator accepts these keywords and forms:

  • $schema, title, and description with string values.
  • type as one type or a unique, non-empty array of types: null, boolean, object, array, number, integer, or string.
  • properties as an object whose values are schemas; required as an array of unique property-name strings; and additionalProperties as a boolean or a schema.
  • items as one schema. Array forms of items are not supported.
  • enum as a non-empty array of up to 100 JSON values, and const as any JSON value.
  • minimum, maximum, exclusiveMinimum, and exclusiveMaximum as finite numbers.
  • minLength and maxLength as non-negative integers. String length is counted in Unicode code points.
  • pattern as a string using the restricted pattern grammar described below.

properties describes how a property is checked when it exists; it does not make that property required. Only names in required must be present. A missing property and a property whose value is null are different: required checks presence, while type checks the value. additionalProperties accepts, rejects, or checks other properties; it never removes or rewrites them in the document.

Rejected keywords and patterns

Every keyword outside the list above is rejected before instance validation. This includes $ref even when it points to a local definition, along with definitions, format, allOf, anyOf, oneOf, not, dependencies, and the conditional keywords if, then, and else. References are not resolved, and the tool never downloads a schema or makes a request to a remote service.

Patterns are limited to ASCII letters and digits, escaped regular-expression punctuation, simple character classes, and ^ or $ only at the start or end. One pattern can use at most one ? quantifier or one bounded {min,max} quantifier whose maximum is 32. Other regular-expression features are rejected. Patterns can be at most 128 code units, and a document string checked by a pattern can be at most 10,000 code units.

Strict JSON and number precision

Both editors require strict JSON. Comments, trailing commas, duplicate object keys, and trailing content are errors. Numbers that cannot be represented safely as JavaScript numbers are rejected; they do not produce a conformance result. The validator uses the parsed JSON value, so it cannot distinguish numeric spellings that have already lost precision.

Input and operation limits

The schema editor accepts up to 100,000 UTF-16 code units. Schema parsing is limited to depth 60, 5,000 JSON nodes, 1,000,000 parser work units, and 100 diagnostics. Schema preflight allows 5,000 structural visits, schema depth 40, 5,000 names across properties and required, 50 patterns, and 100 values in each enum.

The document editor accepts up to 250,000 UTF-16 code units. Document parsing is limited to depth 100, 25,000 JSON nodes, 1,000,000 parser work units, and 100 diagnostics. The complete validation has 5,000,000 work units, 8,192 variable code units per diagnostic, and an 8 second time limit. Reaching a limit stops validation without declaring the document valid or invalid.

Local processing

Parsing and validation run in a local Worker in your browser. Neither input is sent to an application server; schemas are not fetched. Text is not stored in the URL, cookies, or browser storage. Editing either input clears the previous result and stops work that belongs to the earlier text. Cancel stops an active operation and keeps both inputs; Clear both is the explicit way to remove them.