The home of JSON Schema validation right in your browser 🚧 Alpha 🚧 draft-7 only
Valid JSON:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"containtsAsia": {
"contains": {
"properties": {
"region": {
"const": "asia"
}
}
}
},
"containsEurope": {
"contains": {
"properties": {
"region": {
"const": "europe"
}
}
}
}
},
"type": "object",
"properties": {
"stat_data": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"properties": {
"region": {
"enum": [
"america",
"asia",
"europe"
]
},
"country": {
"type": "string"
},
"population": {
"type": "string"
}
}
},
"oneOf": [
{
"allOf": [
{
"$ref": "#/definitions/containtsAsia"
},
{
"not": {
"$ref": "#/definitions/containsEurope"
}
}
]
},
{
"allOf": [
{
"$ref": "#/definitions/containsEurope"
},
{
"not": {
"$ref": "#/definitions/containtsAsia"
}
}
]
}
]
}
}
}
Valid JSON:
{
"stat_data": [{
"region": "america",
"country": "USA",
"states": "50"
}, {
"region": "asia",
"country": "Japan",
"details":{
"language":"Japanese",
"tz": "utc+9.00"
}
},
{
"region": "europe",
"country": "finland",
"language":"Finnish"
}
]
}
should NOT be valid.
not at "#/properties/stat_data/oneOf/0/allOf/1/not"
Instance location: "/stat_data"
should NOT be valid.
not at "#/properties/stat_data/oneOf/1/allOf/1/not"
Instance location: "/stat_data"
should match exactly one schema in oneOf.
oneOf at "#/properties/stat_data/oneOf"
Instance location: "/stat_data"
jsonschema.dev@relequestual Thanks to Sponsors: