JSON Schema Validator
DataValidate a JSON document against a JSON Schema definition. Supports type, properties, required, items, minimum, maximum, enum, and pattern. Free, client-side.
What is a JSON Schema?
JSON Schema is a vocabulary for describing the shape and constraints of JSON data. A JSON Schema Validator takes two inputs โ a schema document and a JSON data document โ and checks whether the data conforms to every rule the schema defines. It is the layer that sits between "is this valid JSON?" and "does this JSON have the structure my application expects?"
This tool implements a subset of JSON Schema Draft-07 entirely in your browser. Paste a schema into the JSON Schema textarea and your data into the JSON Data to Validate textarea. The validator parses both, runs every supported keyword check, and produces a clear Valid or Invalid badge. When validation fails, it reports each error with a dot-notation path โ for example, root.user.email: expected type "string", got "number" โ so you can locate the problem immediately.
All processing is client-side. Your schema and data are never sent to a server, making the tool safe for internal API payloads and configuration files you would prefer to keep private.
For syntax checking without schema constraints, the JSON Validator confirms a string is parseable JSON. For YAML documents, the YAML Validator provides equivalent syntax validation.
How to use this JSON Schema calculator
- Paste your JSON Schema into the JSON Schema textarea. The default example shows a schema that requires an object with
name(string, non-empty) andage(number, 0โ120) properties. Replace it with your own schema. - Paste the JSON document you want to validate into the JSON Data to Validate textarea. The default example shows
{ "name": "Alice", "age": 30 }, which passes the default schema. - The validator runs automatically as you type. Check the Valid / Invalid badge at the top of the results section.
- If the badge shows Invalid, read the error list. Each entry shows the path (e.g.
root.name) and the specific rule that failed (e.g.string length 0 < minLength 1). Navigate to that field in your data and apply the fix. - If the badge shows "Schema is not valid JSON" or "JSON data is not valid JSON", use the JSON Validator to fix the syntax of the offending input first, then return here.
- Iterate until the Valid badge appears and every required constraint is satisfied.
Tip: if you are testing a schema you are writing rather than data you received, try submitting data that should fail to confirm the schema rejects it correctly โ this catches overly permissive schemas before they reach production.
Formula & Methodology
This validator implements a recursive descent algorithm over the JSON Schema keyword set from Draft-07. Given a schema object and a data value, it evaluates every applicable keyword and collects all errors, rather than stopping at the first failure. Error paths are accumulated by passing the current path string (root,root.propertyName,root.arrayName[index]) down through recursive calls. ### Supported keywords by category Type and value identity -typeโ accepts a string or array of strings;"integer"is treated as a subtype of"number"and additionally requiresNumber.isInteger(value)to be true -enumโ value must deep-equal one of the listed items (compared viaJSON.stringify) -constโ value must deep-equal the specified constant String constraints -minLength,maxLengthโ checked againststring.length(character count) -patternโ tested withnew RegExp(pattern).test(value)Number constraints -minimum,maximumโ inclusive bounds -exclusiveMinimum,exclusiveMaximumโ exclusive bounds (Draft-07 number form) -multipleOfโ checked viaNumber.isInteger(value / multipleOf)Array constraints -itemsโ if an object schema, applied to every element; if an array of schemas, applied positionally -minItems,maxItemsโ checked againstarray.length-uniqueItemsโ all elements compared viaJSON.stringify; first duplicate reported with its index -containsโ at least one array element must match the sub-schema Object constraints -requiredโ each listed key must be present in the object -propertiesโ each defined property is validated recursively against its sub-schema if present -additionalPropertiesโ iffalse, any key not inpropertiesis rejected; if an object schema, applied to all keys not inproperties-patternPropertiesโ each key matching the pattern regexp is validated against the associated sub-schema -minProperties,maxPropertiesโ checked againstObject.keys(object).lengthLogical combinators -allOfโ data must pass every sub-schema in the array -anyOfโ data must pass at least one sub-schema -oneOfโ data must pass exactly one sub-schema -notโ data must fail the sub-schema ### Working example Schema โ requires an object with ausername(string, 3โ20 characters) and arole(one of"admin","editor","viewer"):json { "type": "object", "required": ["username", "role"], "properties": { "username": { "type": "string", "minLength": 3, "maxLength": 20 }, "role": { "type": "string", "enum": ["admin", "editor", "viewer"] } }, "additionalProperties": false }Data that fails โusernameis too short androleis not in the enum:json { "username": "ab", "role": "superuser" }Errors produced:root.username: string length 2 < minLength 3 root.role: value must be one of "admin", "editor", "viewer"### Scope and limitations This tool does not support: -$refโ schema references are not resolved; the keyword is silently ignored -$defs/definitionsโ referenced sub-schemas via$refare not inlined -formatโ the keyword is accepted but not validated -if/then/elseโ conditional application keywords from Draft-07 are not implemented - Schema vocabularies,$schemadeclaration enforcement, or annotation collection For production-grade validation with full Draft-07 support including$refresolution, use Ajv in your codebase.
Frequently Asked Questions