What is JSON Schema?
JSON Schema is a powerful vocabulary for describing and validating JSON documents. It acts as a contract that defines what valid JSON should look like - including structure, data types, required fields, and value constraints.
Think of JSON Schema like a blueprint for your data. It specifies the rules that your JSON must follow, and validators like JSON Purrser check if your data complies with those rules.
This is essential for APIs, configuration files, and any system that exchanges JSON data. Schema validation catches errors early and ensures data consistency across your application.
Example Schema & Data:
{
"type": "object",
"required": ["name", "email"],
"properties": {
"name": { "type": "string" },
"email": { "type": "string", "format": "email" },
"age": { "type": "integer", "minimum": 0 }
}
}
{"name": "John", "email": "john@example.com", "age": 30}
What JSON Schema Can Validate
Data Types
string, number, integer, boolean, object, array, null
Required Fields
Ensure mandatory properties are present
Value Constraints
min/max, minLength/maxLength, patterns
Enum Values
Restrict values to a predefined set
Validator Features
Multiple Draft Support
Supports JSON Schema Draft 4, 6, 7, and 2019-09 specifications.
Detailed Errors
Get precise error messages with paths to invalid data and clear explanations.
Real-Time Validation
Instant validation as you type. See results immediately without clicking buttons.
Error Location
Errors show exact JSON paths (e.g., $.user.email) for quick identification.
100% Private
All validation happens in your browser. Neither data nor schema is sent anywhere.
Schema Examples
Built-in example schemas to help you get started with schema validation.
How to Validate JSON Against Schema
Paste JSON Data
Enter the JSON you want to validate in the main editor
Open Schema Panel
Click the "Schema" button in the toolbar
Enter Schema
Paste your JSON Schema definition
Review Results
See validation results with detailed error messages
When to Use JSON Schema Validation
API Development
Validate request and response payloads to ensure API contract compliance.
Configuration Files
Validate config files before deployment to catch errors early.
Data Imports
Validate external data before importing into your database or system.
Form Validation
Use schemas to validate form submissions on both client and server.
Documentation
Schemas serve as living documentation for your data structures.
Testing
Validate test fixtures and mock data against expected schemas.
Frequently Asked Questions
What is JSON Schema?
JSON Schema is a vocabulary that allows you to annotate and validate JSON documents. It describes the structure, content, and format of JSON data, enabling automatic validation of data against a defined schema. Think of it as a contract that specifies what valid JSON should look like.
Why should I validate JSON against a schema?
Schema validation ensures data integrity by catching errors early. It validates that required fields exist, data types are correct, values are within expected ranges, and formats match patterns. This prevents bugs, improves API reliability, and provides clear documentation of your data structure.
Which JSON Schema versions are supported?
JSON Purrser supports JSON Schema Draft 4, Draft 6, Draft 7, and Draft 2019-09 (also known as Draft 8). Draft 7 is the most commonly used version and is recommended for most use cases.
What validation errors can JSON Schema detect?
JSON Schema can detect: missing required properties, incorrect data types, values outside allowed ranges (minimum/maximum), strings not matching patterns (regex), invalid enum values, array items not matching schema, and many more structural and content issues.
Is my data secure when validating?
Yes, completely. JSON Purrser processes all data locally in your browser using JavaScript. Neither your JSON data nor your schema is sent to any server, ensuring complete privacy and security.
Related JSON Tools
Ready to Validate Your JSON?
Ensure data integrity with powerful JSON Schema validation.
Open Schema Validator