Skip to content

Sort dictionary

Sorts the referenced dictionary and returns it as a list of tuples of key and value.

Configuration

Example:

{
  "data": {"first": 1, "second": 2, "fifth": 5, "third": 3},
  "direction": "asc",
  "sort_by": "key"
}

This configuration will sort the dictionary

{"first": 1, "second": 2, "fifth": 5, "third": 3}

with the order provided by direction (default: "asc")

The dictionary is provided as a path to data in event. Example of such configuration.

{
  "data": "[email protected]",
  "direction": "asc",
  "sort_by": "key"
}

Input

This plugin does not process input.

Output

Returns the ordered list of tuples with keys and values.

Example:

{
  "result": [
    ["first", 1], 
    ["second", 2], 
    ["third", 3], 
    ["fifth", 5]
  ]
}