# $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>](https://docs.cosmocloud.io/flow-builder/cql-cosmocloud-query-language/building-expressions).

## 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=""><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>](https://docs.cosmocloud.io/flow-builder/cql-cosmocloud-query-language/building-expressions) 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**.
