I am working to make an Angular 9 app on covid-19 cases where I want to sort my objects based on value of nested objects.
Here is my data I want to sort my statewise object alphabetically on basis of value of field s tate:kerela ,state:haryana ;
{
"history": [
{
"day": "2020-03-14",
"total": {
"confirmed": 84
},
"statewise": [
{
"state": "Kerala",
"confirmed": 19
},
{
"state": "Assam",
"confirmed": 14
}
]
},
{
"day": "2020-03-15",
"total": {
"confirmed": 104
},
"statewise": [
{
"state": "Kerala",
"confirmed": 119
},
{
"state": "Assam",
"confirmed": 114
}
]
}
]
}
so after sorting I want my data like
SOrted Data
{
"history": [
{
"day": "2020-03-14",
"total": {
"confirmed": 84
},
"statewise": [
{
"state": "Assam",
"confirmed": 14
},
{
"state": "Kerala",
"confirmed": 19
}
]
},
{
"day": "2020-03-15",
"total": {
"confirmed": 104
},
"statewise": [
{
"state": "Assam",
"confirmed": 114
},
{
"state": "Kerala",
"confirmed": 119
}
]
}
]
}
The link to my API data is here API data API data link. I have been trying for two days I have tried this answer but still not getting how should I proceed. Any help will be great.