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?
Answer from Jason Desrosiers on Stack OverflowJSON Schema
json-schema.org › learn › miscellaneous-examples
JSON Schema - Miscellaneous Examples
The schema below represents a complex object with various properties including name, age, address, and hobbies. The address property is an object with nested properties, and the hobbies property is an array of strings.
List of objects with required values
How do you define required values in a list? I have a list of objects with a property which is an enum with 10 options. But the list must contain at least 4 items with specific field values. For ex... More on github.com
Contains not working as expected with array of objects
JSON Schema is constraints based, and so anything you don't prohibit is allowed and considered valid. You haven't constrained additional properties using the additionalProperties keyword, so any key in the elements array objects are considered valid. More on github.com
The Last Breaking Change | JSON Schema Blog
always fun to see the json guys struggling with the previous generation's xml issues. Not that I particularly like either, you understand, and honestly json is obviously less crushingly verbose, it's just amusing. People do seem to have to learn the hard way that a lot of the "complicated" stuff xml had was there for a reason. Wonder what format the next generation will be insisting is better that xml and json. https://en.wikipedia.org/wiki/Unique_Particle_Attribution https://lists.w3.org/Archives/Public/www-tag/2004Aug/att-0010/NRMVersioningProposal.html More on reddit.com
JSON Schema as Source of Truth
You want to use JSON schema to design a relational database? More on reddit.com
Videos
- YouTube
09:29
JSON Schema validation in Postman - YouTube
11:50
JSON Schema Validation: How to Validate JSON Schema with Postman?
09:11
JSON Schema validation (nested objects, arrays) in Postman - Part ...
02:50
How to generated nested JSON objects and arrays in Mockaroo - YouTube
05:50
JSON Basics JSON Schema structure - YouTube
JSON Schema
json-schema.org › understanding-json-schema › reference › array
JSON Schema - array
For example, you may represent a street address such as 1600 Pennsylvania Avenue NW as a 4-tuple of the form: ... To do this, we use the prefixItems keyword. prefixItems is an array, where each item is a schema that corresponds to each index of the document's array.
Json-schema
tour.json-schema.org › content › 01-Getting-Started › 06-Array-of-Objects
Array of Objects: Getting Started | A Tour of JSON Schema
1{ 2 "skills": { 3 "type": "array", 4 "items": { 5 "type": "object", 6 "properties": {...} 7 } 8 } 9} Now, try to modify the skills property in the schema given to you in the side editor, and make it an array of objects with name and level properties.
Cswr
cswr.github.io › JsonSchema › spec › arrays
Arrays - JSON Schema
Here we show how to specify collections of JSON types using possibly nested JSON Schemas. Arrays are used to represent ordered sets of values, such as the following sequence of strings:
Opis
opis.io › json-schema › 2.x › array.html
Array type | Opis JSON Schema
An array is valid against this keyword if all unchecked items are valid against the schema defined by the keyword value. An item is considered unchecked if items keyword or prefixItems keyword (starting with draft 2020-12) contains an array of schemas and doesn’t have a corresponding position (index). The value of the keyword must be a valid json schema (object, boolean).
JSON Schema
json-schema.org › understanding-json-schema › reference › object
JSON Schema - object
The required keyword takes an array of zero or more strings. Each of these strings must be unique. ... In Draft 4, required must contain at least one string. In the following example schema defining a user record, we require that each user has a name and e-mail address, but we don't mind if they don't provide their address or telephone number: ... { "type": "object", "properties": { "name": { "type": "string" }, "email": { "type": "string" }, "address": { "type": "string" }, "telephone": { "type": "string" } }, "required": ["name", "email"]}
Rjsf-team
rjsf-team.github.io › json schema › arrays
Arrays | react-jsonschema-form
import { RJSFSchema } from '@rjsf/utils'; import validator from '@rjsf/validator-ajv8'; const schema: RJSFSchema = { type: 'array', items: { type: 'string', }, additionalItems: { type: 'boolean', }, }; render(<Form schema={schema} validator={validator} />, document.getElementById('app')); Any of these options can be set globally if they are contained within the ui:globalOptions block. They can also be overridden on a per-field basis inside a ui:options block as shown below. Array items are orderable by default, and react-jsonschema-form renders move up/down buttons alongside them.
GitHub
github.com › orgs › json-schema-org › discussions › 145
Contains not working as expected with array of objects · json-schema-org · Discussion #145
Using the following schema: { "$schema": "http://json-schema.org/draft-07/schema", "properties": { "elements": { "type": "array", "items": { "type": "object" }, "contains": { "properties": { "someP...
Json-schema
tour.json-schema.org › content › 01-Getting-Started › 05-Arrays
Arrays: Getting Started | A Tour of JSON Schema
Learn how to define arrays in JSON Schema using the type and items keywords, and convert properties to arrays of strings.
MuleSoft
help.mulesoft.com › s › question › 0D52T00004mXUrdSAG › how-do-you-define-an-array-containing-arrays-in-a-json-schema
How do you define an array containing arrays in a JSON ...
June 24, 2025 - Loading · ×Sorry to interrupt · Refresh
JSON Schema
json-schema.org › understanding-json-schema › structuring
JSON Schema - Modular JSON Schema combination
The $ref keyword may be used to create recursive schemas that refer to themselves. For example, you might have a person schema that has an array of children, each of which are also person instances. schema · { "type": "object", "properties": { "name": { "type": "string" }, "children": { "type": "array", "items": { "$ref": "#" } } }} ·
IBM
ibm.com › docs › en › cics-ts › 6.x
Variable arrays of elements in DFHJS2LS
JSON can contain arrays of varying numbers of elements. In general JSON Schemas that contain varying numbers of elements do not map efficiently into a single high-level language data structure. CICS uses container-based mappings or inline mappings to handle varying numbers of elements in JSON data.
Jsonforms
jsonforms.io › examples › array
Array Example - JSON Forms
The array renderer is used, when an object with type array is used. To get a good overview, have a look at the Schema tab in the demo below.
Ajv
ajv.js.org › json-schema.html
JSON Schema | Ajv JSON schema validator
May 5, 2020 - If the data object contains a property that is a key in the keyword value, then to be valid the data object should also contain all properties from the corresponding array of properties in this keyword. ... The value of the keyword should be a map with keys equal to data object properties. Each value in the map should be a JSON Schema.
Cswr
cswr.github.io › JsonSchema › spec › objects
Objects - JSON Schema
January 21, 2019 - Objects in JSON are collections of key:value pairs, where the values in these pairs can be again any JSON Document. JSON schemas that specify objects are called Object Schemas. The document · {"type": "object"} is an Object Schema. It specifies any JSON document that is an object, such as ...
QA Touch
qatouch.com › home › validating json schema: all you need to know
Validating JSON Schema: All You Need To Know
June 24, 2025 - For illustration, the following schema demands that a value be an object with a minimum of two properties and a maximum of five properties: ... Dependencies between object properties are specified using the dependencies keyword. It requires an object with schemas or arrays of property names as values and property names as keys.
Json-schema
tour.json-schema.org › content › 04-Arrays › 01-Specifying-Length-of-an-Array
Specifying Length of an Array: Arrays | A Tour of JSON Schema
Learn to use JSON Schema to validate arrays, specify minimum and maximum number of items, and constrain item formats using regular expressions.