Filter with predicates
Describe what to inspect, how to compare it, and which value to compare against.
Read a predicate #
{
"path": "",
"op": "gt",
"value": 0
}Read this as: the current array item is greater than zero.
| Field | Meaning |
|---|---|
| path | The field within one item. An empty string means the item itself. |
| op | The comparison operation. gt means greater than. |
| value | The expected value or comparison threshold. Here, the number 0. |
Use the same rule in different blocks #
Connect an array to array and configure the predicate object. For [-5, 0, 10, 25] and the rule above:
| Block | Question | Result |
|---|---|---|
| Filter | Which items match? | [10, 25] |
| Any | Does at least one item match? | true |
| All | Does every item match? | false |
| Count Where | How many items match? | 2 |
Filter returns whole matching items in their original order. Add Sort afterwards when you also need ordering.
Try a predicate #
{
"path": "amount",
"op": "gt",
"value": 100
}With [{"name":"A","amount":50},{"name":"B","amount":150}], Filter returns [{"name":"B","amount":150}]. It keeps the entire object, not only amount.
Choose the field path #
| path | Reads |
|---|---|
| "" | The item itself. |
| "amount" | The amount field. |
| "customer.age" | age inside customer. |
| "items.0.price" | price in the first element of a nested items array. |
Paths are relative to one array item. Do not prepend inputs or the name of the outer array. Array indices start at zero. Dot-separated paths are supported; items[0].price, wildcards, and JSONPath expressions are not.
Continue with operators, groups, and edge cases.