JSON TransformArray
removeAt
Remove elements at specific indices
removeAt
Removes the elements at every index in indices. The result preserves the order of the surviving elements.
Options
| Option | Type | Required | Default | Description |
|---|---|---|---|---|
indices | array<integer> | Yes | — | Zero-based indices to remove. Out-of-range ignored. |
Example
Input
["a", "b", "c", "d", "e"]Operation
{ "type": "removeAt", "options": { "indices": [1, 3] } }Output
["a", "c", "e"]In a Circuit Step
{
"name": "drop_flagged_indices",
"description": "Drop messages at the indices marked for removal",
"function": "circuit.core.transform.json",
"input": {
"source": "${{ messages }}",
"operations": [
{ "type": "removeAt", "options": { "indices": [1, 3] } }
]
},
"outputs": [
{
"name": "trimmed_messages",
"description": "Messages with indices 1 and 3 removed",
"value": "${{ drop_flagged_indices.output.transformed_result }}"
}
]
}Notes & gotchas
- Errors with
removeAt: expected arrayif the input is not an array. indicesis deduplicated internally — listing an index twice is harmless.- All indices are interpreted against the original array, not against an iteratively shrinking one (so you don't have to compensate for already-removed earlier indices).
- Out-of-range indices are silently ignored.
- To remove by condition, use
filterwith the inverted predicate.