Skip to content

Keyword array sort

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

array_sort

Sorts an array.

Shape

{
  "{returns}": {
    "array_sort": {
      "array": [],
      "predicates": [
        {
          "key_path": ["name"],
          "order": "ascending"
        }
      ]
    }
  }
}
  • key_path is optional. If omitted, the element itself is sorted.
  • order is ascending or descending.
  • Multiple predicates are applied in order.
  • Sorting is stable when predicate values are equal.

Example

{
  "{returns}": {
    "array_sort": {
      "array": [
        { "name": "Scarecrow", "steps_from_emerald_city": 40 },
        { "name": "Dorothy", "steps_from_emerald_city": 12 }
      ],
      "predicates": [
        {
          "key_path": ["steps_from_emerald_city"],
          "order": "descending"
        }
      ]
    }
  }
}

The result is sorted by steps_from_emerald_city descending.

Clone this wiki locally