📋 JSON Schema Validator
Validate JSON against a JSON Schema or generate a schema from sample JSON.
What Is JSON Schema?
JSON Schema is a vocabulary that allows you to annotate and validate JSON documents. It defines the expected structure, data types, required fields, value constraints, and relationships within a JSON document. Think of it as a contract or blueprint that describes what valid JSON data should look like.
JSON Schema is defined in a series of IETF Internet-Drafts and is widely used in API design (OpenAPI/Swagger), configuration validation, form generation, and data pipeline quality assurance.
Key JSON Schema Keywords
| Keyword | Purpose | Example |
|---|---|---|
type | Defines the expected data type | "type": "string" |
properties | Defines the expected object properties | "properties": { "name": { "type": "string" } } |
required | Lists mandatory fields | "required": ["name", "email"] |
minimum / maximum | Numeric range constraints | "minimum": 0, "maximum": 100 |
minLength / maxLength | String length constraints | "minLength": 1, "maxLength": 255 |
pattern | Regex pattern for string validation | "pattern": "^[A-Z]{2}$" |
enum | List of allowed values | "enum": ["active", "inactive"] |
items | Schema for array elements | "items": { "type": "string" } |
Common Use Cases
- API Validation: Validate request and response bodies against schemas defined in OpenAPI/Swagger specifications.
- Configuration Files: Ensure application configs meet expected structure before deployment.
- Form Generation: Automatically generate HTML forms from JSON Schema definitions.
- Data Pipeline QA: Validate incoming data quality in ETL pipelines before processing.
- Documentation: JSON Schemas serve as self-documenting contracts for data structures.
How to Use This Tool
- Paste your JSON data in the left panel.
- Paste your JSON Schema in the right panel.
- Click Validate to check compliance.
- Review detailed error messages for any validation failures.
Why Use This Tool?
- Validate API payloads against JSON Schema before deployment.
- Catch data structure issues early in development.
- Detailed error messages pinpoint exactly what is wrong.
- Supports JSON Schema Draft 4, 6, 7, and 2020-12.
Frequently Asked Questions
Which JSON Schema version should I use?
Draft 2020-12 is the latest version and recommended for new projects. Draft-07 is still widely supported and used by many tools and libraries.
Can JSON Schema validate nested objects?
Yes. JSON Schema supports deeply nested validation through properties containing
sub-schemas, $ref for reusable definitions, and items for array elements.