JSON Schema Documentation - JSON Tools
The JSON Schema tool helps you create, validate, and manage JSON schemas for data validation. Whether you need to validate data structure, document APIs, or ensure data quality, this tool provides a powerful set of features for working with JSON Schema.
Features
- Schema Creation - Build JSON schemas with an intuitive interface
- Data Validation - Validate JSON data against schemas
- Schema Validation - Ensure your schemas are valid
- Visual Editor - Create schemas without writing code
- Documentation - Generate documentation from schemas
- Import/Export - Share and reuse schemas
How to Use
Creating a Schema
- Start with a new schema or import existing one
- Define properties and their types
- Set validation rules and constraints
- Preview and test the schema
Validating Data
- Enter or paste your JSON data
- Select or enter your schema
- Click "Validate" to check compliance
- Review validation results and errors
Example
Here's an example of a JSON Schema and valid data:
Schema:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"name": {
"type": "string",
"minLength": 2,
"maxLength": 50
},
"age": {
"type": "integer",
"minimum": 0,
"maximum": 120
},
"email": {
"type": "string",
"format": "email"
},
"interests": {
"type": "array",
"items": {
"type": "string"
},
"minItems": 1
}
},
"required": ["name", "age", "email"]
}
Valid JSON data:
{
"name": "John Doe",
"age": 30,
"email": "john@example.com",
"interests": ["programming", "reading"]
}
Schema Keywords
Type Constraints
- type - Specify the data type (string, number, object, etc.)
- enum - List of allowed values
- const - Single allowed value
- format - Predefined formats (email, date, etc.)
Numeric Constraints
- minimum/maximum - Value range limits
- multipleOf - Number must be multiple of value
- exclusiveMinimum/Maximum - Exclusive range limits
String Constraints
- minLength/maxLength - String length limits
- pattern - Regular expression pattern
- format - String format validation
Tips & Tricks
- Schema Reuse - Use $ref to reference common schemas
- Documentation - Add descriptions for better clarity
- Validation - Test with various data scenarios
- Versioning - Use $schema to specify version
- Custom Formats - Define custom validation formats
Common Issues
Schema Validation
- Invalid schema structure
- Missing required properties
- Incorrect type definitions
- Invalid regular expressions
Data Validation
- Type mismatches
- Range violations
- Pattern mismatches
- Missing required fields
Related Tools
- JSON Formatter - Format JSON data before validation
- JSON Generator - Generate sample data from schemas