Validate JSON Schema Online: Test Your Schema Against Real Data
Last updated:
A JSON Schema validator checks whether a JSON value matches a schema definition — verifying types, required fields, value ranges, string formats (email, uri, date-time), and array constraints. Paste your JSON and schema into Jsonic's JSON Schema Validator for an instant result — it uses Ajv 8, which supports JSON Schema Draft-07 and Draft 2020-12. Validation errors include the exact JSON Pointer path (/user/email) and a human-readable message for each violation. This guide covers writing schemas for common cases: required fields, optional fields with defaults, nested objects, enum values, and pattern-matched strings.
Paste your schema and data into Jsonic's JSON Schema Validator to see validation errors immediately.
Validate JSON Schema nowWhat JSON Schema validation checks
A JSON Schema validator checks a JSON value against a schema and reports each rule that fails. The most common checks are:
- type — is the value the right type (string, number, boolean, array, object, null)?
- required — are all required keys present?
- properties — do object properties match their individual schemas?
- enum — is the value one of the allowed values?
- minimum / maximum — is a number within the allowed range?
- minLength / maxLength — is a string within the allowed length?
- pattern — does a string match the regex pattern?
- format — does a string match a named format like email or date?
- additionalProperties — are unexpected keys allowed?
Minimal schema: type and required fields
// Schema
{
"type": "object",
"required": ["id", "name"],
"properties": {
"id": { "type": "integer" },
"name": { "type": "string" }
}
}
// ✅ Valid data
{ "id": 1, "name": "Alice" }
// ❌ Fails: name is missing
{ "id": 1 }
// ❌ Fails: id is a string, not integer
{ "id": "1", "name": "Alice" }Enum: restrict to allowed values
{
"type": "object",
"properties": {
"status": {
"type": "string",
"enum": ["active", "inactive", "pending"]
}
}
}
// ✅ Valid
{ "status": "active" }
// ❌ Fails: "banned" is not in the enum
{ "status": "banned" }For more enum patterns, see the JSON Schema examples guide.
Nested object validation
{
"type": "object",
"required": ["user"],
"properties": {
"user": {
"type": "object",
"required": ["id", "email"],
"properties": {
"id": { "type": "integer" },
"email": { "type": "string", "format": "email" }
}
}
}
}
// ✅ Valid
{ "user": { "id": 1, "email": "alice@example.com" } }
// ❌ Fails: email format invalid
{ "user": { "id": 1, "email": "not-an-email" } }Array of objects
{
"type": "array",
"items": {
"type": "object",
"required": ["id", "name"],
"properties": {
"id": { "type": "integer" },
"name": { "type": "string" }
}
},
"minItems": 1
}
// ✅ Valid
[{ "id": 1, "name": "Alice" }, { "id": 2, "name": "Bob" }]
// ❌ Fails: empty array violates minItems
[]Block unexpected keys with additionalProperties
{
"type": "object",
"properties": {
"name": { "type": "string" }
},
"additionalProperties": false
}
// ✅ Valid
{ "name": "Alice" }
// ❌ Fails: unknown is not in properties
{ "name": "Alice", "unknown": true }This is useful for strict API contracts where unexpected fields should be rejected rather than silently ignored.
Using $ref to reuse schemas
{
"$defs": {
"Address": {
"type": "object",
"required": ["city", "country"],
"properties": {
"city": { "type": "string" },
"country": { "type": "string" }
}
}
},
"type": "object",
"properties": {
"billing": { "$ref": "#/$defs/Address" },
"shipping": { "$ref": "#/$defs/Address" }
}
}$ref lets you define a schema once and reuse it multiple times, keeping large schemas maintainable. See the JSON Schema tutorial for a full walkthrough.
How to validate a schema online
- Open the JSON Schema Validator.
- Paste your schema in the Schema panel.
- Paste a sample JSON value in the Data panel.
- The validator reports whether the data passes and lists every failed rule with the path.
Testing with both valid and invalid data is important: confirm that the schema accepts what it should and rejects what it should.
Test your schema now
Paste a schema and a JSON value into Jsonic's JSON Schema Validator. Errors show the exact path and rule that failed.
Open JSON Schema ValidatorFrequently asked questions
How do I test a JSON Schema against real data?
Paste your schema and sample data into an online JSON Schema validator. Test both valid data (confirm it passes) and invalid data (confirm it rejects bad values). Jsonic's JSON Schema Validator runs entirely in your browser with instant feedback.
What online tools validate JSON Schema?
Jsonic's JSON Schema Validator provides instant validation with error paths. Other options include jsonschemavalidator.net and the official JSON Schema website validator. VS Code also validates schemas inline when $schema is declared in the file.
What JSON Schema errors are most common?
Most common errors: missing required properties, type mismatch (string vs number), enum violation, minimum/maximum out of range, format error (invalid email), pattern mismatch, additional property rejected, and minLength/maxLength violation.
How do I fix a "required" validation error?
Add the missing property to your data. If the error says must have required property 'email', add "email" to the object. If the field should be optional, remove it from the required array in the schema.
What is the difference between Draft-04, Draft-07, and Draft-2020-12?
Draft-04 established core keywords. Draft-07 added if/then/else and changed exclusiveMinimum/Maximum to numeric values. Draft 2020-12 renamed definitions to $defs, moved tuple validation to prefixItems, and added unevaluatedProperties.
How do I validate a JSON Schema itself?
Use a validator against the appropriate meta-schema for your draft. In Ajv: ajv.validateSchema(yourSchema). VS Code validates schemas automatically when $schema points to the meta-schema URL.
Recommended reading
- Designing Data-Intensive Applications (2nd Edition) — Martin Kleppmann & Chris RiccominiThe modern classic on data systems — encoding formats, schemas, replication, and stream processing.
- JavaScript: The Definitive Guide (7th Edition) — David FlanaganThe complete reference for the language JSON came from — serialization, async, and the full standard library.
As an Amazon Associate, Jsonic earns from qualifying purchases.