I have a large object that I need to sort by a value, so that is is listed in descending order (the range is 7-2
). At the moment, I'm not sure what is really handling the sorting order, it seems fairly random to me though I assume there is some logic.
Here is an example subset of the data:
property_list = {
1 : {
description : '...',
specs : {
bedroom_number: 7
}
},
2 : {
description : '...',
specs : {
bedroom_number: 3
}
},
3 : {
description : '...',
specs : {
bedroom_number: 5
}
}
}
So I need to reorder by specs.bedroom_number
so that they are arrange as 7
, 5
, 3
in terms of the bedroom number value.
Is this sort of sorting possible? Or does it require some sort of loop to work through the object and add each object to a new set of data?