I am pretty new to JavaScript. I have a nested object and I want to be able to reorder the key/value pairs. I tried looking for a solution at a lot of places online but mostly found answers to sort a 2-D array, nothing with this complexity level.
My object looks something like this:
id:{
Category1 : {
a : {count:1, volume:5}
b : {count:2, volume:10}
}
Category2: {
a : {count:4, volume:8}
b : {count:10, volume:4}
}
}
and I want to sort it on the basis of the name instead of category. Intedend result:
id:{
a : {
Category1 : {count:1, volume:5}
Category2 : {count:4, volume:8}
}
b: {
Category1 : {count:2, volume:10}
Category2 : {count:10, volume:4}
}
}