Validate JSON Schema array or object

Validate JSON Schema array or object

Somethings a JSON response contains attributes which (depending on the resource) might be ether and object or an array. When writing a JSON schema, you usually use just one type. But there is a way to define two options.

To do this you simply have to use an array instead of a string in your configuration.

So use this:

"data": {
    "type": ["object", "array"]
}

instead of this:

"data": {
    "type": "object"
}