I have a nested object that looks like this.I want to sort this in ascending and descending order based on the alphabetical order of Districtnames.
var data =
{"DistrictC":{"population":105597},
"DistrictB":{"population":36842},
"DistrictA":{"population":238142}}
Expected output in ascending order is shown below.I also need to sort in descending order.
{"DistrictA":{"population":238142},
"DistrictB":{"population":36842},
"DistrictC":{"population":105597}}