> For the complete documentation index, see [llms.txt](https://docs.cosmocloud.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cosmocloud.io/flow-builder/cql-cosmocloud-query-language/building-expressions/usdarrayelemat.md).

# $arrayElemAt

`$arrayElemAt` operator returns you an item inside an array using it's index. You can use this in any [<mark style="color:blue;">**Expression Object**</mark>](/flow-builder/cql-cosmocloud-query-language/building-expressions.md).

## Syntax

```json
{
    "$arrayElemAt": [ <array_obj>, <index> ]
}
```

### Properties

| Field         | Description                                                                                                                                                                                                                                                          | Required |
| ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
| \<array\_obj> | <p>The <code>\<array\_obj></code> expression can be any valid <a href="/pages/E96SHGHwhXp256hQZFJ6"><mark style="color:blue;"><strong>expression</strong></mark></a> as long as it resolves to a list/array.</p><p></p><p>It can also be a Magical Autocomplete.</p> | true     |
| \<index>      | The `<index>` expression can be any valid [<mark style="color:blue;">**expression**</mark>](/flow-builder/cql-cosmocloud-query-language/building-expressions.md) as long as it resolves to a number.                                                                 | true     |

### Returns

`<object>` - Returns the object at the defined index. The object type can be anything present in the array.

## Examples

### Timestamp in epoch (seconds)

```json
{
    "$arrayElemAt": [ [1,2,3,4], 1 ]
}
```

The above expression returns **2**.

### With Magical Autocomplete

Let's say we have declared a variable `tempArr` in our API flow, which has an array value of `["Hello", "World", "Here"]` currently.

```json
{
    "$arrayElemAt": [ "$.variables.tempArr", 2 ]
}
```

The above expression would resolve to a result of **Here**.
