The home of JSON Schema validation right in your browser 🚧 Alpha 🚧 draft-7 only
Valid JSON:
xxxxxxxxxx
{
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "http://example.com/baseSchema.json",
"type": "object",
"required": [
"payload"
],
"properties": {
"payload": {
"$id": "#/properties/payload",
"type": "object",
"oneOf": [
{
"if": {
"required": [
"user"
]
},
"then": {
"$ref": "userSchema.json"
},
"else": false
},
{
"if": {
"required": [
"users"
]
},
"then": {
"$ref": "usersSchema.json"
},
"else": false
}
]
}
},
"definitions": {
"user": {
"$id": "http://example.com/userSchema.json",
"type": "object",
"required": [
"user"
],
"properties": {
"user": {
"$ref": "userProperties.json"
}
}
},
"users": {
"$id": "http://example.com/usersSchema.json",
"type": "object",
"required": [
"users"
],
"properties": {
"users": {
"type": "array",
"items": {
"$ref": "userProperties.json"
}
}
}
},
"userProperties": {
"$id": "http://example.com/userProperties.json",
"type": "object",
"properties": {
"firstName": {
"type": "string"
}
}
}
}
}
Valid JSON:
xxxxxxxxxx
{
"status": {
"code": 200,
"description": "User retrieved successfully."
},
"payload": {
"user": {
"firstName": 1,
"lastName": "Doe",
"role": "3",
"email": "doe@example.com",
"customerID": "",
"projects": [
"AIXG5mEg6QLl9rhVSE6m",
"Bs1bHiOIqKclwwis3CNf",
"NC2OUGVZXU35FA7iwRn4"
],
"status": "Status",
"id": "c555BSZnKLdHSRYqrU5hqiQo733j13"
}
}
}
should be string.
type at "userProperties.json/properties/firstName/type"
Instance location: "/payload/user/firstName"
should match "then" schema.
if at "#/properties/payload/oneOf/0/if"
Instance location: "/payload"
boolean schema is false.
false schema at "#/properties/payload/oneOf/1/else/false schema"
Instance location: "/payload"
should match "else" schema.
if at "#/properties/payload/oneOf/1/if"
Instance location: "/payload"
should match exactly one schema in oneOf.
oneOf at "#/properties/payload/oneOf"
Instance location: "/payload"
jsonschema.dev@relequestual Thanks to Sponsors: