Object Variables

Variables may also be objects that contain properties.

In this case, the type of the variable should be an object that defines what properties are allowed in that object.

The following variable in JavaScript:

let nameOfVariable = {
  foo: "someString",
  bar: 10
}

could be defined like this:

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

Example 1-1 An Object Containing Another Object

This JavaScript object

let otherObject = {
  foo: {
    name: "myName"
  },
  bar: 10
}

can be described by the following structure:

"otherObject": {
  "type": {
    "foo": {
      "name": "string",
    },
    "bar": "number"
  }
}