$arrayElemAt
$arrayElemAt
operator returns you an item inside an array using it's index. You can use this in any Expression Object.
Syntax
{
"$arrayElemAt": [ <array_obj>, <index> ]
}
Properties
Field
Description
Required
<array_obj>
The <array_obj>
expression can be any valid expression as long as it resolves to a list/array.
It can also be a Magical Autocomplete.
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)
{
"$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.
{
"$arrayElemAt": [ "$.variables.tempArr", 2 ]
}
The above expression would resolve to a result of Here.
Last updated