Free Online JSON Schema Validator
Validate your JSON data against a JSON Schema online. Ensure your data conforms to the expected structure and types in your browser.
Input
About JSON Schema Validator
What is JSON Schema?
JSON Schema is a vocabulary that allows you to annotate and validate JSON documents. It serves as a contract for what JSON data is required for a given application and how to interact with it. Think of JSON Schema as a blueprint for your JSON data.
Using JSON Schema, you can clearly document the structure of your JSON data, including what fields are required, what types they should be, and any constraints on their values. This makes it easier to validate data, generate documentation, and create interfaces.
How JSON Schema Validation Works
JSON Schema validation is the process of checking whether a JSON document conforms to the rules defined in a schema. The validation process involves:
- Parsing both the schema and the data to ensure they are valid JSON
- Compiling the schema into a validation function
- Running the validation function against the data
- Collecting and reporting any validation errors
Our tool uses Ajv, one of the fastest and most standards-compliant JSON Schema validators available for JavaScript.
Key Features of Our JSON Schema Validator
- Support for JSON Schema draft-07 standard
- Detailed error reporting to pinpoint validation issues
- Tabbed interface to easily switch between data and schema editing
- Client-side processing (your data never leaves your browser)
- Syntax highlighting for error messages
- Predefined examples to help you get started
Common Use Cases
- Validating API request and response bodies
- Defining configuration file structures
- Creating data models for applications
- Documenting data formats for team collaboration
- Testing data before submission or processing
- Automating form validation in web applications
- Creating self-documenting data structures
JSON Schema Basics
JSON Schema uses keywords to define validation rules. Here are some of the most common ones:
- type: Specifies the data type (string, number, object, array, boolean, null)
- properties: Defines the properties of an object
- required: Lists the required properties of an object
- minLength/maxLength: Constrains the length of strings
- minimum/maximum: Constrains numeric values
- pattern: Defines a regex pattern for strings
- enum: Restricts a value to a predefined set of values
- format: Specifies a semantic format (e.g., date-time, email, uri)
- items: Defines the schema for array items
Example JSON Schema
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"id": { "type": "integer" },
"name": { "type": "string" },
"email": {
"type": "string",
"format": "email"
},
"age": {
"type": "number",
"minimum": 0
},
"tags": {
"type": "array",
"items": { "type": "string" }
}
},
"required": ["id", "name", "email"]
}