zahubtech@local $ json-schema-validator --live
JSON Schema Validator — validate JSON against a schema online
This JSON Schema validator checks a JSON document against a JSON schema live in the browser, listing every validation error — wrong type, missing required property, value out of range, malformed email — as you type. It is the fast way to validate JSON against a schema online, debug why a payload is rejected, and confirm the shape of an API response before you wire it into code.
It validates a practical draft-7 subset: `type`, `required`, `properties`, `minimum`/`maximum`, `format` (email and uri), `minLength`/`maxLength`, `pattern` and array `items`. You can also infer a starting schema straight from your document with one click, then tighten it. Everything runs entirely in your browser; nothing you paste is uploaded.
Usage
- Paste or edit your JSON document in the top "json document" box. As long as it parses, its shape is also rendered as a structure tree below the result.
- Paste your JSON schema in the "json schema" box — or click "↯ generate from document" to infer a draft-7 schema from the current document, then edit it.
- Read the result panel: a green "valid" line when the document conforms, or a list of validation errors each pointing at the failing path (e.g. `age: Must be >= 0`).
- Tweak the document or the schema and the result updates live — a JSON parse error in either box is reported as a single error rather than crashing the validation.
Examples
- Require properties and constrain a number:
{ "type": "object", "required": ["name", "age"], "properties": { "age": { "type": "number", "minimum": 0 } } } - `required` forces `name` and `age` to be present, and `minimum: 0` rejects a negative age. A document missing `name` reports `root: Missing required property 'name'`; an age of `-1` reports `age: Must be >= 0, got -1`. This is the most common JSON schema validation: required keys plus a value range.
- Validate an email format string:
{ "type": "object", "properties": { "email": { "type": "string", "format": "email" } } } - With `format: "email"`, a value like `not-an-email` reports `email: Invalid email format`, while `ada@zahub.com` passes. The validator also supports `format: "uri"` for `http(s)` URLs — useful for checking link fields in a config or API payload.
- Constrain string length and pattern:
{ "type": "string", "minLength": 3, "maxLength": 20, "pattern": "^[a-z0-9_]+quot; } - A username schema: `minLength`/`maxLength` bound the length and `pattern` (a regular expression) restricts the allowed characters. `"ab"` fails the length check; `"Ada!"` fails the pattern. Combine these to validate slugs, codes and identifiers.
- Validate every item in an array:
{ "type": "array", "items": { "type": "number" } } - `items` applies a sub-schema to each element of an array, so `[1, 2, "three"]` reports a type error on the offending element. Nest `items` with an object schema to validate an array of records, each against the same `properties`/`required` rules.
FAQ
- How do I validate JSON against a schema online?
- Paste your JSON document into the top box and your JSON schema into the schema box. The validator checks the document live and lists any errors — wrong type, missing required property, out-of-range value — with the path to each failure. Everything runs in your browser; nothing is uploaded.
- Which JSON Schema keywords are supported?
- A practical draft-7 subset: `type`, `required`, `properties`, `minimum`/`maximum`, `format` (email and uri), `minLength`/`maxLength`, `pattern` and array `items`. Unsupported keywords are ignored rather than erroring, so you can validate the common cases without a full draft-7 implementation.
- Can I generate a JSON schema from an example document?
- Yes — click "↯ generate from document" and the tool infers a draft-7 schema from whatever is in the document box: object properties become `properties`, every key is marked `required`, arrays get an `items` schema from their first element, and email/URI-looking strings get the matching `format`. Use it as a starting point and tighten it by hand.
- Why does my JSON document fail validation?
- Read the error list: each line names the failing path and the rule it broke (e.g. `email: Invalid email format` or `tags: Expected type 'array', got 'string'`). If the very first error mentions a JSON parse problem, the document or schema itself is not valid JSON — fix the syntax first, then re-check against the schema.
- Is this a draft-7 JSON Schema validator?
- It validates against a draft-7-style subset of keywords and runs entirely client-side using the native JavaScript engine, so it is well suited to quick checks and debugging. For full draft-2020-12 features (such as `$ref`, `allOf`/`anyOf` or conditional schemas) use a complete library — this tool deliberately covers the high-frequency keywords.
✓ valid · document conforms to the schema
root:object(3)