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 Overflow
🌐
CSVJSON
csvjson.com
CSVJSON - CSVJSON
JSON Beautifier bug fix: Inline short arrays was not working properly. GitHub issue #9 · CSV to JSON bug fix: If no text is present in a csv field, it was assigned 0 (zero) by default. CSV to JSON bug fix: strings containing quotes and commas were prematurely cut. Make the GitHub repository public again. Re-opened to community. ... Transpose: You can now transpose the csv data before conversion. Output object instead of array: By default an array of objects is output.
CSV to JSON
Turn on respective Parse Numbers and Parse JSON switches to convert valid numbers and JSON (null, false, true, [] and {}). With CSVJSON you can transpose the csv before conversion. Rows become columns, and columns become rows. With CSVJSON you can output a hash (or object) instead of an array.
JSON CSV or TSV
In French, Excel will expect a semi-colons ; instead of a comma ,. Make sure to pick that option if you are going to import the CSV file in Excel. CSV values are plain text strings. Dror Harari proposed a variant called CSVJSON (csvjson.org). The variant proposes that every CSV value be a valid JSON value. More specifically, objects and arrays ...
Discussions

jsonSchema working only for the first item of an array of objects
I had built an API that was working with NodeJS and express, ones I felt confident with it I learnt Mongo in order to get closer to the MERN stack. Everything is working smoothly and now, just for learning purposes, I’m trying to enforce a schema so that post and put methods are somewhat limited. More on mongodb.com
🌐 mongodb.com
1
0
August 9, 2023
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
🌐 github.com
1
1
June 30, 2022
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
🌐 r/programming
270
529
January 31, 2023
JSON Schema as Source of Truth
You want to use JSON schema to design a relational database? More on reddit.com
🌐 r/devops
9
2
April 30, 2023
🌐
Atlassian
developer.atlassian.com › cloud › jira › platform › rest › v3 › intro
The Jira Cloud platform REST API
Operations that return an error status code may also return a response body containing details of the error or errors. The schema for the response body is shown below: ... { "id": "https://docs.atlassian.com/jira/REST/schema/error-collection#", "title": "Error Collection", "type": "object", "properties": { "errorMessages": { "type": "array", "items": { "type": "string" } }, "errors": { "type": "object", "patternProperties": { ".+": { "type": "string" } }, "additionalProperties": false }, "status": { "type": "integer" } }, "additionalProperties": false }
🌐
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.
🌐
Protocol Buffers
protobuf.dev › programming-guides › proto3
Language Guide (proto 3) | Protocol Buffers Documentation
Because of this, adding the optional modifier doesn’t change the field presence for the field. The definitions for Message2 and Message3 in the following code sample generate the same code for all languages, and there is no difference in representation in binary, JSON, and TextFormat:
🌐
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.
Find elsewhere
🌐
FastAPI
fastapi.tiangolo.com › tutorial › body
Request Body - FastAPI
For example, this model above declares a JSON "object" (or Python dict) like: { "name": "Foo", "description": "An optional description", "price": 45.2, "tax": 3.5 } ...as description and tax are optional (with a default value of None), this JSON "object" would also be valid:
🌐
JSON 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.
🌐
MongoDB
mongodb.com › working with data
jsonSchema working only for the first item of an array of objects - Working with Data - MongoDB Community Hub
August 9, 2023 - I had built an API that was working with NodeJS and express, ones I felt confident with it I learnt Mongo in order to get closer to the MERN stack. Everything is working smoothly and now, just for learning purposes, I’m trying to enforce a schema so that post and put methods are somewhat limited.
🌐
Todoist
developer.todoist.com › api › v1
Todoist API
Every user who shares at least one project with another user, has a collaborators record in the API response. The record contains a restricted subset of user-specific properties. Partial sync returns updated collaborator objects for users that have changed their attributes, such as their name or email.
🌐
Jsonpathfinder
jsonpathfinder.com
JSON Path Finder
0: Enter your JSON in the editor. 1:Select an item to view its path. 2:Replace 'x' with the name of your variable.
🌐
Mistral AI
docs.mistral.ai › api
API Specs
The maximum number of tokens to generate in the completion. The token count of your prompt plus max_tokens cannot exceed the model's context length. *array<SystemMessage|UserMessage|AssistantMessage|ToolMessage>
🌐
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:
🌐
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.
🌐
opencode
opencode.ai › docs › sdk
SDK | OpenCode
1 week ago - type: "json_schema", schema: { type: "object", properties: { company: { type: "string", description: "Company name" }, founded: { type: "number", description: "Year founded" }, products: { type: "array", items: { type: "string" }, description: "Main products", }, }, required: ["company", "founded"], }, }, }, }) // Access the structured output ·
🌐
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).
🌐
Gsu
tinman.cs.gsu.edu › ~raj › 8711 › sp21 › json › JSONSchema.html
JSON and JSON Schema
{ "$schema": "http://json-schema.org/draft-06/schema#", "definitions": { "person": { "type": "object", "properties": { "name": { "type": "string" }, "children": { "type": "array", "items": { "$ref": "#/definitions/person" }, "default": [] } } } }, "type": "object", "properties": { "person": { "$ref": "#/definitions/person" } } }
🌐
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.