If ascending order was the case, then you can easily match each components of the array with theirselves to make "ERROR" : "ERROR"
and "REJECT" : "REJECT"
pairs within a shift transformation, and apply sort transformation.
But, unfortunately there's no direct method to get the descending order whereas a workaround might be given through reversely indexing the components of the array such as
[
{ // reform subarrays with repeating components and having keys identical to those repeated components
// each subarray will be sorted in alphabetical order spontaneously
"operation": "shift",
"spec": {
"*": {
"status": {
"*": {
"*": {
"$": "&3.&[]"
}
}
}
}
}
},
{ // convert arrays to attributes by matching each common key with each component
"operation": "shift",
"spec": {
"*": {
"*": {
"*": "&2.&1&"
}
}
}
},
{ // convert whole content to a unique array back, named "status"
"operation": "shift",
"spec": {
"*": {
"*": {
"@": "&2"
}
}
}
},
{ // prepare "key" and "val" arrays to be used within the upcoming specs
"operation": "shift",
"spec": {
"*": {
"*": {
"$": "&2.key.&",
"@": "&2.val"
}
}
}
},
{
"operation": "modify-overwrite-beta",
"spec": {
"*": {
"sz__": "=size(@(1,key))",
"sz_": "=divide(@(1,sz__),-1)",
"sz": "=toInteger(@(1,sz_))",
"key": {
"*": "=intSum(@(1,&),@(2,sz))"
}
}
}
},
{ // get "key" and "val" arrays
"operation": "shift",
"spec": {
"*": {
"key": {
"*": {
"@": "&3.&2"
}
},
"*": "&1.&"
}
}
},
{ // match each components of those arrays among them
"operation": "shift",
"spec": {
"*": {
"key": {
"*": {
"@(2,val[&])": "&3.@(3,key[&])"
}
}
}
}
},
{ // sort by keys
"operation": "sort"
},
{ // convert attributes back to a unique array
"operation": "shift",
"spec": {
"*": {
"*": {
"@": "&2"
}
}
}
}
]