Open
Description
Is your feature request related to a problem? Please describe.
I want to sort list of objects by key.
And, I want to reverse list.
Describe the solution you'd like
sortBy:
echo '[
{
"id": 1,
"updatedAt": "2024-09-04T00:00:00+09:00"
},
{
"id": 2,
"updatedAt": "2024-09-03T00:00:00+09:00"
}
]' | dasel -r json 'sortBy(updatedAt)'
[
{
"id": 2,
"updatedAt": "2024-09-03T00:00:00+09:00"
},
{
"id": 1,
"updatedAt": "2024-09-04T00:00:00+09:00"
}
]
reverse:
echo '[
{
"id": 1,
"updatedAt": "2024-09-04T00:00:00+09:00"
},
{
"id": 2,
"updatedAt": "2024-09-03T00:00:00+09:00"
}
]' | dasel -r json 'reverse()'
[
{
"id": 2,
"updatedAt": "2024-09-03T00:00:00+09:00"
},
{
"id": 1,
"updatedAt": "2024-09-04T00:00:00+09:00"
}
]
Describe alternatives you've considered
nothing.
Additional context
sortBy
is referred to in the discussion here.