Validation Tools

JSON Schema Validator & Generator

Check JSON data against a JSON Schema and see every error with its instance path, schema path and line number, or generate a starting schema from a sample document. Supports draft 2020-12, 2019-09 and draft-07 with format validation.

Private by design: anything you enter is processed in your browser only. It is never uploaded to or logged on our servers. Schemas and data are validated locally with Ajv. Remote $ref URLs are not fetched.

Examples:
Validation also runs as you type.
Paste a JSON Schema and the JSON data to validate.

About JSON Schema validation

JSON Schema describes what a JSON document must look like: which properties exist, their types, which are required, allowed values, string formats and nested structures. It is used to validate API requests and responses (OpenAPI 3.1 uses JSON Schema 2020-12 directly), configuration files, form input and messages between services.

This validator uses Ajv, the most widely used JSON Schema implementation for JavaScript, with ajv-formats for formats such as email, uri, date-time and uuid. The draft is picked from the schema's $schema keyword, or you can force one. With Report all errors on, every failing keyword is listed instead of stopping at the first one.

Each error shows the instance path (a JSON Pointer to the failing value, such as /items/1/qty), the schema path (the keyword in the schema that failed, such as #/definitions/item/properties/qty/minimum) and the line in your data, which is highlighted below the table.

The Generate schema tab infers a schema from a sample: types, nested objects, required keys, array item schemas merged across all elements, nullable and mixed types, and common string formats. Treat the result as a starting point and add limits, enums and descriptions by hand. To check plain JSON syntax only, use the JSON validator; to compare two documents, use the JSON diff tool; to validate a whole API description, use the OpenAPI validator.

Reference Guide

Differences between the supported drafts that most often cause surprises:

FeatureDraft-07Draft 2019-09Draft 2020-12
Reusable definitionsdefinitions$defs$defs
Tuples (fixed positions)items: [..] + additionalItemsitems: [..] + additionalItemsprefixItems + items
Siblings next to $refIgnoredAppliedApplied
Conditional propertiesdependenciesdependentRequired, dependentSchemasdependentRequired, dependentSchemas
Close extended schemasNot availableunevaluatedPropertiesunevaluatedProperties, unevaluatedItems
$schema URIhttp://json-schema.org/draft-07/schema#https://json-schema.org/draft/2019-09/schemahttps://json-schema.org/draft/2020-12/schema

Draft-04 and draft-06 schemas are checked with draft-07 rules and a notice. Remote $ref URLs are not downloaded; put shared schemas under $defs and reference them with #/$defs/name.

Frequently Asked Questions

Draft 2020-12, draft 2019-09 and draft-07. The draft is detected from the $schema keyword, or you can choose one. Draft-04 and draft-06 schemas are checked with draft-07 rules and a notice.

The instance path is a JSON Pointer to the value in your data that failed, for example /items/1/qty. The schema path points to the keyword in the schema that rejected it, for example #/properties/items/items/properties/qty/minimum.

Yes, with Validate formats switched on. The validator uses ajv-formats, which checks email, uri, date, time, date-time, uuid, ipv4, ipv6, hostname, regex and more. Without it, format is only an annotation.

It walks a sample document and records the type of every value. Objects get properties and required keys, array items are merged into one item schema, values that are sometimes null become nullable, and common string formats are detected. Review the result and add limits, enums and descriptions.

References inside the same schema, such as #/$defs/address, work. Remote URLs are not downloaded, so copy shared definitions into $defs.