I asked this same question on the JSON schema google group, and it was answered quickly. User fge asked that I post his response here:

Hello,

The current specification is draft v4, not draft v3. More specifically, the validation specification is here:

https://datatracker.ietf.org/doc/html/draft-fge-json-schema-validation-00

The web site is not up to date, I don't know why... I'll submit a pull request.

With draft v4 you can use this:

{
    "type": "array",
    "items": {
        "oneOf": [
            {"first": [ "schema", "here" ] }, 
            {"other": [ "schema": "here" ] }
        ]
    }  
}

For instance, this is a schema for an array where items can be either strings or integers (it can be written in a more simple way though):

{
    "type": "array",
    "items": {
        "oneOf": [
            {"type": "string"},
            {"type": "integer"}
        ]
    }
}

This is the correct answer. My corrected schema now includes:

"transactions" : {
    "type" : "array",
    "items" : {
        "oneOf" : [
            {
                "type" : "object",
                "properties" : {
                    "type" : {
                        "type" : "string",
                        "enum" : ["BUILD", "REASSIGN"]
                    }
                }
            },
            {
               "type" : "object",
               "properties" : {
                 "type" : {
                   "type" : "string",
                   "enum" : ["BREAK"]
                  }
               }
            }
        ]
    }
}
Answer from deepwinter on Stack Overflow
🌐
JSON Schema
json-schema.org › understanding-json-schema › reference › array
JSON Schema - array
The word "unevaluated" does not ... unevaluatedItems to false, you can disallow extra items in the array. ... Here, all the values are evaluated. The schema passes validation....
🌐
Ajv
ajv.js.org › json-schema.html
JSON Schema | Ajv JSON schema validator
The value of the keyword should be an array of JSON Schemas. The data is valid if it is valid according to all JSON Schemas in this array. ... These keywords allow to implement conditional validation.
Discussions

validation - Correct JSON Schema for an array of items of different type - Stack Overflow
I have an unordered array of JSON items. According to the specification https://datatracker.ietf.org/doc/html/draft-zyp-json-schema-03#section-5.5 the json schema below will only validate if the objects in the array appear IN THAT ORDER. I don't want to specify an order, just validate the objects ... More on stackoverflow.com
🌐 stackoverflow.com
php - JSON Schema validation: validate array of objects - Stack Overflow
I use justin rainbows library to validate the schema against the json data packagist.org/packages/justinrainbow/json-schema ... when you look json-schema website, the "required" is not at the same place as in your exemple : json-schema.org/examples.html ... There are some errors in your schema. First, you are using properties for an array object... More on stackoverflow.com
🌐 stackoverflow.com
jsonschema - JSON Schema definition for array of objects - Stack Overflow
I've also tried to generate the schema using this online tool but that also doesn't work, and to verify that that should output the correct result, I've tried validating that output against jsonschemavalidator.net, but that also gives me a similar error: Found 1 error(s) Message: Invalid type. Expected Array but got Object... More on stackoverflow.com
🌐 stackoverflow.com
Using JSON schema with an array of mixed object types
There was an error while loading. Please reload this page · as far as I understand - this should be a valid schema: More on github.com
🌐 github.com
17
March 6, 2013
🌐
Cswr
cswr.github.io › JsonSchema › spec › arrays
Arrays - JSON Schema
In this case, we are asking that the first element must be a string, the second one an integer and the third one a boolean. For example, this array validates against the schema ... Note that the default behaviour of JSON Schema allows us to have fewer items, as long as the corresponding (sub)schemas are satisfied.
🌐
JSON Schema
json-schema.org › learn › miscellaneous-examples
JSON Schema - Miscellaneous Examples
The fruits property contains an array of strings, while the vegetables property contains an array of objects, each adhering to the "veggie" schema definition. This example introduces the enum validation keyword which is used with an array of values that includes an integer (42), a boolean (true), a string ("hello"), null, and an array ([1, 2, 3]).
Top answer
1 of 5
73

I asked this same question on the JSON schema google group, and it was answered quickly. User fge asked that I post his response here:

Hello,

The current specification is draft v4, not draft v3. More specifically, the validation specification is here:

https://datatracker.ietf.org/doc/html/draft-fge-json-schema-validation-00

The web site is not up to date, I don't know why... I'll submit a pull request.

With draft v4 you can use this:

{
    "type": "array",
    "items": {
        "oneOf": [
            {"first": [ "schema", "here" ] }, 
            {"other": [ "schema": "here" ] }
        ]
    }  
}

For instance, this is a schema for an array where items can be either strings or integers (it can be written in a more simple way though):

{
    "type": "array",
    "items": {
        "oneOf": [
            {"type": "string"},
            {"type": "integer"}
        ]
    }
}

This is the correct answer. My corrected schema now includes:

"transactions" : {
    "type" : "array",
    "items" : {
        "oneOf" : [
            {
                "type" : "object",
                "properties" : {
                    "type" : {
                        "type" : "string",
                        "enum" : ["BUILD", "REASSIGN"]
                    }
                }
            },
            {
               "type" : "object",
               "properties" : {
                 "type" : {
                   "type" : "string",
                   "enum" : ["BREAK"]
                  }
               }
            }
        ]
    }
}
2 of 5
7

I've been looking into this for quite a while too. But haven't been able to find a working solution. It works fine if you have only one schema eg.

"transactions" : {
          "type" : "array",
          "items" : 
          {
            "type" : "object",
            "properties" : {
              "type" : {
                "type" : "string",
                "enum" : ["BREAK"]
              },
          }
}

Then you just skip the array brackets, and use an object. However if you want to do what you are doing, there seems to be no solid answer. This is the only thing that I've found so far: http://the-long-dark-tech-time.blogspot.se/2012/12/using-json-schema-with-array-of-mixed.html

🌐
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 ...
Find elsewhere
🌐
QA Touch
qatouch.com › home › validating json schema: all you need to know
Validating JSON Schema: All You Need To Know
June 24, 2025 - An object fails validation if it has fewer properties than the minProperties or more properties than the maxProperties. For illustration, the following schema demands that a value be an object with a minimum of two properties and a maximum of ...
🌐
MongoDB
mongodb.com › company › blog › json-schema-validation--checking-your-arrays
JSON Schema Validation - Checking Your Arrays | MongoDB
JSON schema validation can greatly enhance your application and add security to your system. In this particular case, we've used validation to ensure that there are no duplicates in embedded arrays in a document, entirely through defining the ...
🌐
MongoDB
mongodb.com › blog › post › json-schema-validation--checking-your-arrays
JSON Schema Validation - Checking Your Arrays | MongoDB Blog
November 18, 2019 - We can use the uniqueItems keyword in our schema validator to ensure uniqueness. db.foodColor.drop() db.createCollection ( "foodColor", { validator: { $jsonSchema: { bsonType: "object", required: ["name", "box_size", "dyes"], properties: { _id: {}, name: { bsonType: ["string"], description: "'name' is a required string" }, box_size: { enum: [3, 4, 6], description: "'box_size' must be one of the values listed and is required" }, dyes: { bsonType: ["array"], minItems: 1, // each box of food color must have at least one color uniqueItems: true, additionalProperties: false, items: { bsonType: ["ob
🌐
Liquid Technologies
liquid-technologies.com › Reference › XmlStudio › JsonSchemaEditor_Property_AdditionalItems.html
Additional Items
In this example the schema is specified ... array items (note the [3-n] indicator). The first 3 objects in the instance array must validate against the corresponding schema, but any additional items must validate against the [3-n] schema....
🌐
IETF
ietf.org › archive › id › draft-wright-json-schema-validation-01.xml
JSON Schema Validation: A Vocabulary for Structural Validation of JSON
For objects, primitive type validation ... as a whole based on the presence of specific property names. Each JSON Schema validation keyword adds constraints that an instance must satisfy in order to successfully validate....
🌐
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.
🌐
GitHub
github.com › java-json-tools › json-schema-validator › issues › 46
Using JSON schema with an array of mixed object types · Issue #46 · java-json-tools/json-schema-validator
March 6, 2013 - as far as I understand - this should be a valid schema: { "type" : "array", "items" : { "type" : [ { "type" : "object", "properties" : { "name" : { "type" : "string" }}}, { "type" : "object", "properties" : { "price" : { "type" : "number...
Author   ettig
🌐
GitHub
github.com › apiaryio › api-blueprint › issues › 338
JSON Schema for array of objects is Invalid · Issue #338 · apiaryio/api-blueprint
June 28, 2016 - { "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "properties": { "links": { "type": "array", "items": [ { "type": "object", "properties": { "rel": { "type": "string" }, "href": { "type": "string" } }, "required": [ "rel", "href" ], "additionalProperties": false } ] } }, "required": [ "links" ] } in this case the validator show errors only in the first element others dont validate.
Author   kesslerdev
🌐
GitHub
github.com › tdegrunt › jsonschema › issues › 182
Validate object or array of objects · Issue #182 · tdegrunt/jsonschema
August 8, 2016 - tdegrunt / jsonschema Public · Notifications · You must be signed in to change notification settings · Fork 267 · Star 1.9k · New issueCopy link · New issueCopy link · Closed · Closed · Validate object or array of objects#182 · Copy link · vladotesanovic · opened · on Aug 8, 2016 · Issue body actions · Is it possible to do something like: const schema = { "type": ["object", "array"], "properties": { "key": { "type": "string", "required": true }, "value": { "type": "string", "required": true } } }; const objectValidation = v.validate({key: "Name", value: "A10"}, schema); const arrayValidation = v.validate([{key: "Name", value: "A10"}], schema); To validate object or array of objects with same type?
Author   vladotesanovic
🌐
Stack Overflow
stackoverflow.com › questions › 49766728 › schema-validation-for-json-array-of-objects-using-java
Schema validation for Json array of objects using Java - Stack Overflow
This validates that the first item of the array is a string and the second item is an integer. Anything passed the second item is ignored (unless you use additionalItems) ... So, in your schema, you've defined a tuple of one element and the ...
🌐
IBM
ibm.com › docs › SSEP7J_11.0.0 › com.ibm.swg.ba.cognos.ag_manage.doc › c_cust_json_schema.html
JSON schema validation
May 17, 2022 - When you upload a spec.json file, it is validated against the following schema.
🌐
Oracle
docs.oracle.com › en › database › oracle › oracle-database › 26 › adjsn › json-schema.html
JSON Schema
January 22, 2026 - SELECT DBMS_JSON_SCHEMA.validate_report('{"name" : "scott", "role" : "developer"}', '{"type" : "array"}') AS myreport; Use PL/SQL JSON_ELEMENT_T Boolean method schema_validate(). It accepts a JSON schema as argument, of type JSON, VARCHAR2, or JSON_ELEMENT_T. For example, if d is a PL/SQL instance of type JSON_ELEMENT_T then this code returns a BOOLEAN value that indicates whether the JSON data d is valid (TRUE) or not (FALSE) against the JSON schema passed as argument. That is, it checks whether the data is a JSON object.