Array Variables

Variables can represent arrays.

Arrays are defined the same way as objects. However, in this case, the object type is inside an array.

Arrays can have nested objects or arrays as well, and object types can also contain nested arrays.

Example 1-2 An Array Represented by a Variable

A JavaScript array

let myArray = [
  {
    foo: "someString",
    bar: 10
  },
  {
    foo: "someOtherString",
    bar: 11
  }
]

can be represented like this:

"nameOfVariable": {
  "type": [
    {
      "foo": "string",
      "bar": "number"
    }
  ]
}

Example 1-3 An Array of Strings

"nameOfVariable": {
  "type": "string[]"
}