entries
Decompose an object into an array of [key, value] pairs. Essential for dynamic key processing.
object(required): the object to decompose
bash
echo '{"servers": {"prod": {"host": "prod-db"}, "staging": {"host": "stg-db"}}}' \
| utlx -e 'entries($input.servers)'
# [["prod", {"host": "prod-db"}], ["staging", {"host": "stg-db"}]]utlx
{
environments: entries($input.servers) |> map((entry) -> {
environment: entry[0],
host: entry[1].host
})
}