Validate JSON Schema Online: Test Your Schema Against Real Data
A JSON Schema validator checks whether a JSON value matches a schema definition — verifying types, required fields, value ranges, and formats. This guide explains what it validates and how to write schemas for common cases.
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 a full reference on enum schemas, see JSON Schema enum.
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 Validator