Looking to organize a JSON object by sorting based on price from lowest to highest.
{
"BEY": {
"1": {
"price": 2280,
"airline": "QR",
},
"2": {
"price": 2108,
"airline": "UA",
}
},
"BKK": {
"1": {
"price": 2956,
"airline": "QR",
},
"2": {
"price": 1718,
"airline": "WS",
}
}
}
The goal is to re-arrange it so that the ticket price becomes the key. Here's an example:
{
1718: {
"airline" : "WS",
"IATA_Code" : "BKK"
},
2108: {
"airline" : "UA",
"IATA_Code" : "BEY"
},
2280: {
"airline" : "QR",
"IATA_Code" : "BEY"
},
2956: {
"airline" : "QR",
"IATA_Code" : "BKK"
}
}