JSONToonPro
Schema validator

JSON Schema Validator Online

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.

100% client sideDraft-07Schema generator
Input/ JSON
223 chars13 lines
Output/ JSON Schema
907 chars57 lines

What JSON Schema Actually Checks

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 Versions

DraftStatusWhat changed
draft-04Legacyrequired as an array, exclusiveMinimum as a boolean
draft-06SupersededIntroduced const, contains, propertyNames
draft-07The practical baselineif / then / else, readOnly, content keywords
2019-09Adopted slowly$defs replaces definitions, $recursiveRef, annotations
2020-12CurrentprefixItems 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.

Core Keywords

KeywordApplies toMeaning
typeAnyRestricts to string, number, integer, boolean, object, array, or null
propertiesObjectDeclares a subschema for each named key
requiredObjectAn array of key names that must be present
additionalPropertiesObjectfalse forbids unlisted keys, or give a subschema they must match
itemsArrayThe subschema every element must satisfy
minItems / maxItemsArrayBounds on length
uniqueItemsArraytrue rejects duplicate elements
enumAnyThe value must be one of an explicit list
constAnyThe value must equal exactly one thing
minimum / maximumNumberInclusive bounds, with exclusive variants available
multipleOfNumberDivisibility, useful for currency steps
minLength / maxLengthStringBounds counted in characters, not bytes
patternStringA regular expression the value must match
formatStringNamed formats such as email, uri, date-time, uuid
oneOfAnyMust match exactly one of the listed subschemas
anyOfAnyMust match at least one
allOfAnyMust match every one, used for composition
notAnyMust fail the given subschema
$refAnyReuse a subschema defined elsewhere, including recursively
$defsSchemaWhere 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.

A Worked Example

The schema

{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"required": ["id", "email", "role"],
"additionalProperties": false,
"properties": {
"id": { "type": "integer", "minimum": 1 },
"email": { "type": "string", "format": "email" },
"role": { "type": "string",
"enum": ["admin", "editor", "viewer"] },
"age": { "type": "integer",
"minimum": 13, "maximum": 130 },
"tags": { "type": "array",
"items": { "type": "string" },
"maxItems": 5 }
}
}

Valid document

{
"id": 42,
"email": "lena@example.com",
"role": "editor",
"age": 31,
"tags": ["beta", "eu"]
}

Invalid document

{
"id": 0,
"email": "lena@example.com",
"role": "owner",
"age": 31,
"nickname": "Lee"
}

Errors reported for the invalid document

/id must be >= 1
(minimum) got 0
 
/role must be one of
"admin", "editor", "viewer"
(enum) got "owner"
 
/ must NOT have additional property
"nickname"
(additionalProperties)

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.

Where Schemas Get Used

  • API request validation. Reject a malformed body at the edge with a precise error instead of letting it reach business logic and fail obscurely.
  • Configuration validation. Catch a typo in a config file at startup with a clear message rather than at three in the morning when a feature silently misbehaves.
  • OpenAPI specifications. The components section of an OpenAPI document is JSON Schema, so learning one teaches you most of the other.
  • Form generation. Libraries render a working form directly from a schema, so the validation rules and the UI cannot drift apart.
  • Editor autocomplete. Add a $schema key to a config file and editors offer completion, inline documentation, and red squiggles while you type.
  • Test fixtures and contract testing. Assert that a recorded response still matches the agreed shape after a dependency changes.
  • Documentation. A schema with description and examples keywords is machine readable documentation that cannot go stale.

Schemas Versus TypeScript Types

They look like they do the same job and they operate at opposite ends of the program lifecycle.

TypeScript typeJSON Schema
Checked atCompile timeRun time
Exists in the shipped codeNo, erased entirelyYes, it is data
Validates untrusted inputNoYes, that is the point
Value constraintsOnly literal unionsRanges, patterns, lengths, uniqueness
Error messagesCompiler diagnostics for youStructured errors you can return to a caller
Shareable across languagesNoYes, any language with a validator
CostFree at run timeA 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.

How to validate JSON against a schema

Three steps
01

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.

02

Paste your JSON data

Enter the JSON you want to validate in the left panel of the Validate tab. The validator checks it against your schema instantly.

03

Review validation results

See a clear pass or detailed error list with paths like root.user.email so you know exactly what to fix.

Built for API and data validation

Validate API responses, config files, and form data against a schema before they reach your application, with detailed error paths to fix issues fast.

100% client side

Your JSON and schemas stay in the browser. No upload, no server, no logs.

Live validation

Validation results update instantly as you edit JSON data or schema.

Detailed errors

Each error includes the full path and a clear description of the violated constraint.

Schema generation

Auto-generate a draft-07 schema from any JSON with required and additionalProperties options.

Draft-07 subset

Supports type, required, properties, pattern, enum, minimum, maximum, items, and more.

Download schema

Export the generated schema as a schema.json file for use in your projects.

Frequently asked questions

7 answers
Switch to the Validate JSON tab. Paste your JSON data in the left panel and your JSON Schema in the right panel. Validation results appear instantly below, showing which constraints are met or violated.

JSON Schema Validation, Draft-07 Subset

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.

More JSON Tools