Generate or paste a schema
Use the JSON → Schema tab to auto-generate a draft-07 schema from your JSON, or paste an existing schema directly in the Validate tab.
Validate JSON against a JSON Schema (draft-07) or generate a schema from any JSON data. Paste your schema and data, see validation results instantly with paths for every error, and export schemas for use in your projects, entirely in your browser.
A JSON parser tells you whether a document is syntactically valid JSON. That is a low bar: a missing comma fails, and absolutely everything else passes. JSON Schema is the layer above, describing what a valid document means for your application rather than for the parser.
A schema is itself a JSON document, which is the design decision that makes the whole thing practical. Schemas can be stored, versioned, diffed, transmitted over an API, and validated by other schemas, all with tooling you already have. There is no separate grammar to learn, only a vocabulary of keywords.
The keywords are assertions about a value. Applied to an instance they produce a pass or a fail, and on failure a validator reports which part of the document broke which rule, expressed as a JSON Pointer path.
| Draft | Status | What changed |
|---|---|---|
| draft-04 | Legacy | required as an array, exclusiveMinimum as a boolean |
| draft-06 | Superseded | Introduced const, contains, propertyNames |
| draft-07 | The practical baseline | if / then / else, readOnly, content keywords |
| 2019-09 | Adopted slowly | $defs replaces definitions, $recursiveRef, annotations |
| 2020-12 | Current | prefixItems for tuples, $dynamicRef, unevaluatedProperties |
Draft-07 remains the version with the broadest library support across languages, and it is the safe default unless you specifically need something newer. The most visible difference for anyone moving forward is tuple validation: draft-07 uses an array value for items, while 2020-12 uses prefixItems and reserves items for the rest of the array. Declare your draft in the $schema keyword so validators know which rules to apply rather than guessing.
| Keyword | Applies to | Meaning |
|---|---|---|
| type | Any | Restricts to string, number, integer, boolean, object, array, or null |
| properties | Object | Declares a subschema for each named key |
| required | Object | An array of key names that must be present |
| additionalProperties | Object | false forbids unlisted keys, or give a subschema they must match |
| items | Array | The subschema every element must satisfy |
| minItems / maxItems | Array | Bounds on length |
| uniqueItems | Array | true rejects duplicate elements |
| enum | Any | The value must be one of an explicit list |
| const | Any | The value must equal exactly one thing |
| minimum / maximum | Number | Inclusive bounds, with exclusive variants available |
| multipleOf | Number | Divisibility, useful for currency steps |
| minLength / maxLength | String | Bounds counted in characters, not bytes |
| pattern | String | A regular expression the value must match |
| format | String | Named formats such as email, uri, date-time, uuid |
| oneOf | Any | Must match exactly one of the listed subschemas |
| anyOf | Any | Must match at least one |
| allOf | Any | Must match every one, used for composition |
| not | Any | Must fail the given subschema |
| $ref | Any | Reuse a subschema defined elsewhere, including recursively |
| $defs | Schema | Where reusable subschemas live, called definitions before 2019-09 |
One trap worth naming: required and properties are independent. Listing a key under properties does not make it mandatory, and a key can be listed in required without appearing in properties at all. Forgetting required is the single most common reason a schema passes documents it should reject.
The schema
Valid document
Invalid document
Errors reported for the invalid document
Three separate failures, each with a pointer to the offending location and the keyword that rejected it. A validator reports all of them at once rather than stopping at the first, which is what makes schema errors usable as form validation messages.
They look like they do the same job and they operate at opposite ends of the program lifecycle.
| TypeScript type | JSON Schema | |
|---|---|---|
| Checked at | Compile time | Run time |
| Exists in the shipped code | No, erased entirely | Yes, it is data |
| Validates untrusted input | No | Yes, that is the point |
| Value constraints | Only literal unions | Ranges, patterns, lengths, uniqueness |
| Error messages | Compiler diagnostics for you | Structured errors you can return to a caller |
| Shareable across languages | No | Yes, any language with a validator |
| Cost | Free at run time | A real validation pass per document |
A type asserts that a value has a shape. A schema checks it. Casting a fetch response with as tells the compiler to stop asking questions and does absolutely nothing to the bytes that arrived. If the API changed last night, your typed code walks straight into undefined.
The two are complements rather than competitors. Use types everywhere inside your own code, where you control both sides, and validate with a schema at every trust boundary: HTTP requests, webhook payloads, uploaded files, message queue events, and configuration read from disk. Tools exist to generate types from a schema so the two never disagree, which gives you one source of truth and both kinds of checking.
Validation fits alongside the other ways of pinning down a payload. Browse the full converter collection for JSON to TypeScript to get compile time types from the same sample, JSON to GraphQL for a schema that also defines an API surface, and JSON Formatter to tidy a document before you validate it.
Use the JSON → Schema tab to auto-generate a draft-07 schema from your JSON, or paste an existing schema directly in the Validate tab.
Enter the JSON you want to validate in the left panel of the Validate tab. The validator checks it against your schema instantly.
See a clear pass or detailed error list with paths like root.user.email so you know exactly what to fix.
Validate API responses, config files, and form data against a schema before they reach your application, with detailed error paths to fix issues fast.
Your JSON and schemas stay in the browser. No upload, no server, no logs.
Validation results update instantly as you edit JSON data or schema.
Each error includes the full path and a clear description of the violated constraint.
Auto-generate a draft-07 schema from any JSON with required and additionalProperties options.
Supports type, required, properties, pattern, enum, minimum, maximum, items, and more.
Export the generated schema as a schema.json file for use in your projects.
This validator checks JSON data against a JSON Schema (draft-07) schema. Supported keywords include: type (including integer), required, properties, additionalProperties, items, minItems, maxItems, uniqueItems, minLength, maxLength, pattern, minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf, enum, and const. Errors include the full JSON path to the failing value so you can identify exactly which field violates which constraint. The schema generator produces a draft-07 schema from any JSON value including nested objects and arrays.