I am new to Jolt.
Please how do I sort the following array in descending alphabetical order
Input :
[
{
"status": [
"ERROR",
"ERROR",
"REJECT",
"ERROR",
"ERROR",
"ERROR",
"ERROR"
]
}
]
I want status REJECT to be the first object, so the output is:
[
{
"status": [
"REJECT",
"ERROR",
"ERROR",
"ERROR",
"ERROR",
"ERROR",
"ERROR"
]
}
]
I have seen the jolt sort operation:
{
"operation": "sort"
}
But, how to I point it at the status array and also specify I need a descending sort please?
XPath 3.1 can do that:
Or with
Of course any XPath 3.1 solution can also be used in XSLT 3.0 or XQuery 3.1. I see you removed the xslt tag while I wrote the answer but I will post it as an alternative anyway.