Skip to content

Keyword array filter

Oliver Atkinson edited this page May 10, 2026 · 1 revision

array_filter

Keeps array elements whose predicate returns true.

The predicate runs once for each element. During each predicate run, item is the current element.

Shape

{
  "{returns}": {
    "array_filter": {
      "array": [],
      "predicate": true
    }
  }
}

Example

{
  "{returns}": {
    "array_filter": {
      "array": [
        { "name": "Dorothy", "has_ticket": true },
        { "name": "Scarecrow", "has_ticket": false }
      ],
      "predicate": {
        "{returns}": {
          "comparison": {
            "equal": {
              "lhs": { "{returns}": { "item": ["has_ticket"] } },
              "rhs": true
            }
          }
        }
      }
    }
  }
}

The result keeps only Dorothy.

Clone this wiki locally