JSON Schema Validator

Validate JSON data against JSON Schema definitions. Get detailed error reports with paths. All processing done in your browser.

Instant Validation Error Details Client-Side Processing

How to Use JSON Schema Validator

1

Enter Schema

Define your JSON Schema that describes the expected structure.

2

Enter Data

Paste the JSON data you want to validate against the schema.

3

Validate

Click Validate and review the results for any errors.

What is JSON Schema?

JSON Schema is a vocabulary that allows you to annotate and validate JSON documents. It provides a contract for what JSON data is required for a given application and how to interact with it. JSON Schema is used for validation, documentation, and generating mock data.

Key Features

Type Validation

Validate types: string, number, integer, boolean, array, object, null

Constraints

Min/max length, range, pattern, required fields, and more

Structure Definition

Define nested objects, arrays, and complex data structures

Frequently Asked Questions

What version of JSON Schema is supported?

This tool supports JSON Schema Draft-07, Draft 2019-09, and Draft 2020-12 through the Ajv library. Most common schema features are supported.

Can I validate nested objects?

Yes! JSON Schema supports deeply nested objects and arrays. You can define properties and items at any level of nesting, with individual validation rules for each field.

What happens if my schema is invalid?

The tool first validates that your schema itself is valid JSON Schema. If the schema has errors, those will be reported before attempting to validate the data.

Which JSON Schema keywords are used the most?

type (string, number, object, array, boolean, null), properties with nested schemas, required listing mandatory keys, enum for fixed value sets, pattern for regex-constrained strings, and the range checks minimum/maximum and minLength/maxLength. additionalProperties: false tightens objects against extra keys. Together they cover the bulk of API validation rules.

How do format keywords like date-time and email behave?

In modern JSON Schema, format is an annotation by default, not an automatic assertion - validators enforce it only when configured to, which the 2020-12 spec made explicit with a separate format-assertion vocabulary. Use pattern or a custom keyword when enforcement must be guaranteed, and treat format as interoperability metadata otherwise.

What is $ref and how does schema reuse work?

$ref pointing at #/$defs/address references a schema fragment under $defs and validates against it wherever used - the deduplication mechanism. Draft 2020-12 renamed the older definitions to $defs and formalized $dynamicRef for recursive structures like comment trees. References can also point at external documents, though bundling locally is more common.

How do oneOf, anyOf, and allOf differ?

allOf requires every subschema to validate - an intersection, used to compose a base schema with extra constraints. anyOf requires at least one - a union, used for polymorphic payloads. oneOf requires exactly one; validating two or zero subschemas fails, which is stricter than people expect and the usual cause of surprising errors with overlapping schemas.

What changed between draft-07 and 2020-12?

2020-12 split the specification into separately-negotiable vocabularies (validation, annotation, format-assertion), renamed definitions to $defs, simplified exclusiveMinimum to a plain number, and replaced the older items keyword with prefixItems plus items. Most tooling supports both; draft-07 remains the most widely deployed, but 2020-12 is the current published standard.

{-- * External Resources Component(#18 Phase 3b 内容佐证工程) * 工具页「权威引用」区块:RFC / W3C / WHATWG / ECMA / IANA / 官方规范站 / Wikipedia。 * * - 接受 :slug 属性 → 经 config/tool-sources.php 家族矩阵渲染该工具的权威引用 * - slug 未命中映射时不渲染(无权威来源的工具静默跳过) * - 链接 title 保持英文(引用源专名);description 经 * common.resources.descriptions.{key} 本地化,lang 未命中回退英文(线上不裸奔) * - 链接保持 dofollow(rel="noopener noreferrer") * * @param string|null $slug --}}