Hi all,
I have multiple objects which I need to sort according to an id. Here is an example of my data
{
"data": {
"0": {
"GTIN" : 14235
"id" : 1
}
"1": {
"GTIN" : 14241
"id" : 4
}
"2": {
"GTIN" : 14243
"id" : 2
}
}
}
I need to sort the entire data object based on the id fields inside the nested objects. So this should be my outcome:
{
"data": {
"0": {
"GTIN" : 14235
"id" : 1
}
"2": {
"GTIN" : 14243
"id" : 2
}
"1": {
"GTIN" : 14241
"id" : 4
}
}
}
I tried several options using JMESpath (sort_by, sort etc.) but can’t get it to work. Is there a way to do this?