Repository navigation
Keyword array reduce
Oliver Atkinson edited this page May 10, 2026
·
1 revision
Reduces an array to a single value.
Each iteration receives an item context with:
-
item: the current array element -
index: the current zero-based index -
accumulator: the current accumulated value
{
"{returns}": {
"array_reduce": {
"array": [],
"initial": 0,
"next": 0
}
}
}This example uses the optional eval keyword as the reducer.
{
"{returns}": {
"array_reduce": {
"array": [2, 3, 5],
"initial": 0,
"next": {
"{returns}": {
"eval": {
"expression": "accumulator + item",
"context": {
"accumulator": { "{returns}": { "item": ["accumulator"] } },
"item": { "{returns}": { "item": ["item"] } }
}
}
}
}
}
}
}The result is 10.