JSON Schema definition for array of objects JSON Schema definition for array of objects json json

JSON Schema definition for array of objects


You have defined your schema correctly, except that it doesn't match the data you say you are validating. If you change the property names to match the schema, you still have one issue. If you want to allow "toll" and "message" to be null, you can do the following.

{  "type": "array",  "items": {    "type": "object",    "properties": {      "loc": {        "type": "string"      },      "toll": {        "type": ["string", "null"]      },      "message": {        "type": ["string", "null"]      }    },    "required": [      "loc"    ]  }}

However, that isn't related to the error message you are getting. That message means that data you are validating is not an array. The example data you posted should not result in this error. Are you running the validator on some data other than what is posted in the question?