I have a data structure as follow:
Clients= {
"data": [
{
"nClients": 3
},
{
"name": "cTest1",
"roll_no": 1,
"branch": "c"
},
{
"name": "fTest3",
"roll_no": 3,
"branch": "it3"
},
{
"name": "aTest2",
"roll_no": 2,
"branch": "it2"
}
]
}
I am trying to sort it out by the key ‘name’ alphabetically to have a result like this:
Clients= {
"data": [
{
"nClients": 3
},
{
"name": "aTest2",
"roll_no": 2,
"branch": "it2"
},
{
"name": "cTest1",
"roll_no": 1,
"branch": "c"
},
{
"name": "fTest3",
"roll_no": 3,
"branch": "it3"
}
]
}
I have been looking around using the function sort(), dump() ecc, but I cannot find the correct syntax for this operation. Any suggestion?
Thank you!