API version: 0.3.0

---

# Object

`object` holds a JSON object, whose properties can be defined by the schema as well. Objects can be nested without
a limit of the API.

| Value       | Example                      |
| ----------- | ---------------------------- |
| JSON object | `{"min": -2.5, "max": 24.1}` |

## Settings

| Setting                | Meaning                                                                                                                                                                                                                                                                                                                 |
| ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `properties`           | The definitions of the nested properties, with the same settings as top-level properties.                                                                                                                                                                                                                               |
| `additionalProperties` | What the object accepts besides its `properties`: `true` anything, `false` nothing, or a definition (e.g. `{"type": "number"}`) which every further property has to match. The definition must not be an `object` or a `vector`. Default: `false` in [`strict`](/reference/schemas.md#modes) schemas, `true` otherwise. |

Keys of objects are never `null`: setting a key to `null` removes it.

In a `strict` schema, objects only accept their defined `properties`, on every level and also inside lists, like the
schema itself only accepts defined properties. An object which holds free data, e.g. `{"type": "object"}` for
arbitrary metadata, needs `"additionalProperties": true` there. The default only concerns the validation of the API: the
MongoDB validator and the Elasticsearch mapping only restrict objects with an explicit `"additionalProperties": false`.

## Storage

| Database      | Stored as                                                                                                      | Notes                                                        |
| ------------- | -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------ |
| MongoDB       | embedded document                                                                                              | (default), the only option                                   |
| Neo4j         | not supported                                                                                                  | Neo4j has no nested values, `"storage": "graph"` is rejected |
| Elasticsearch | `object`, with the mapping of the nested properties; `"additionalProperties": false` maps it `dynamic: strict` | search copy                                                  |

The [search copy](/reference/databases/elasticsearch.md) is written unless the property or the type sets `"search": false`.
Where a property is stored is explained in [placement](/reference/schemas/placement.md).

## Indices

None for the object itself. Nested properties can have every intent, they are indexed in MongoDB by their path, see
[nested properties](/reference/indices.md#nested-properties).

## Limits

MongoDB stores at most 100 levels of nesting and 16 MB per document, Elasticsearch maps at most 20 levels
(`index.mapping.depth.limit`) and 1000 fields per index, see [databases](/reference/databases.md).

## Example

Schema:

```json
{
  "type": "object",
  "properties": {
    "min": {
      "type": "number",
      "required": true
    },
    "max": {
      "type": "number"
    }
  },
  "additionalProperties": false
}
```

Input and output:

```json
{
  "data": {
    "temperature": {
      "min": -2.5,
      "max": 24.1
    }
  }
}
```

---

Home: [Ember Nexus API docs](/index.md)

Full site map: [llms.txt](/llms.txt)

Previous: [MultiPolygon](/reference/schemas/types/multipolygon.md)

Next: [List](/reference/schemas/types/list.md)
