JSON Schema Validator
Validate JSON data against a JSON Schema. Get detailed error messages with exact paths for any violations.
JSON Schema Best Practices
Write better schemas and catch more validation errors.
Start with the Required Fields
Define your 'required' array first, then add type constraints for each property. This catches missing fields early and documents your data contract clearly for other developers.
Use Descriptive Error Messages
Add a 'description' field to each property in your schema. When validation fails, these descriptions help developers understand what data is expected without reading the full schema.
Leverage Schema Composition
Use allOf, anyOf, and oneOf to compose complex schemas from simpler ones. This promotes reuse and keeps your schemas DRY. Use $ref to reference shared definitions.
Validate in CI/CD Pipelines
Use JSON Schema validation in your build pipeline to catch invalid configuration, test fixtures, or API contract violations before deployment. This prevents runtime errors in production.
Schema Validation Features
Comprehensive JSON Schema validation tools.
Schema Draft Support
Supports JSON Schema Draft 4, 6, 7, 2019-09, and 2020-12 specifications.
Detailed Error Reports
Get precise error messages with JSON paths pointing to exactly where validation failed.
Side-by-Side View
View your JSON data and schema side by side for easy cross-referencing.
What is JSON Schema?
JSON Schema is a vocabulary that lets you validate the structure and content of JSON data. It describes the expected shape, types, and constraints of a JSON document — similar to how a database schema defines the structure of a table.
Basic Example
A schema that requires a "name" (string) and "age" (number):
{
"type": "object",
"required": ["name", "age"],
"properties": {
"name": { "type": "string" },
"age": { "type": "number", "minimum": 0 }
}
}Valid Data
{ "name": "Alice", "age": 30 }Invalid Data
{ "name": 123, "age": -5 }Common Keywords
typeDefines the expected type: string, number, object, array, boolean, null
requiredLists properties that must be present in an object
propertiesDefines schemas for each property of an object
itemsSchema for array items — validates each element
enumRestricts value to a fixed list of allowed values
patternValidates a string against a regular expression pattern
JSON Schema Validator FAQ
What is JSON Schema?
JSON Schema is a vocabulary for annotating and validating JSON documents. It defines the structure, types, and constraints that your JSON data should follow.
Which schema drafts are supported?
The validator supports JSON Schema Draft 4, 6, 7, 2019-09, and 2020-12. The draft version is auto-detected from the $schema keyword.
Can I validate nested objects?
Yes, the validator fully supports nested schemas including $ref references, allOf/anyOf/oneOf combinators, and recursive schemas.
How do I specify required fields in a schema?
Add a 'required' array at the same level as 'properties' containing the names of mandatory fields. List each required property name as a string in the array, then define type constraints under 'properties' for validation.
What is the difference between anyOf, oneOf, and allOf?
allOf means the data must match ALL listed schemas. anyOf means it must match at least ONE. oneOf means it must match EXACTLY one (and fail the rest). Use allOf for combining base schemas, anyOf for flexible unions, and oneOf for strict alternatives.
Does the validator check the schema itself for errors?
Yes, the schema must be valid JSON and conform to JSON Schema syntax. If your schema has structural issues (e.g., invalid type values or malformed keywords), the validator will report schema-level errors.
Can I use $ref to reference shared definitions?
Yes, internal $ref references to definitions within the same schema document are fully supported. This lets you define reusable sub-schemas in a 'definitions' or '$defs' section and reference them throughout your schema.
Related Tools
Explore more JSON tools to streamline your workflow.
JSON Validator
Validate JSON instantly with precise error messages. Get exact line and column numbers for any syntax errors.
JSONPath Tester
Test JSONPath expressions against your JSON data. See matching results instantly as you type.
JSON Formatter
Pretty print and beautify JSON with configurable indentation. Paste your JSON and format it instantly.
Fix Invalid JSON Online
Paste broken JSON and get it fixed automatically. Handles trailing commas, single quotes, comments, unquoted keys and other common syntax mistakes.
JSON Diff
Compare two JSON documents side by side. Instantly spot additions, removals, and changes with color-coded diff highlighting.