I have below structure
{
'searchResult' : [{
'resultType' : 'station',
'ranking' : 0.5
}, {
'resultType' : 'station',
'ranking' : 0.35
}, {
'resultType' : 'station',
'ranking' : 0.40
}
]
}
and want to get
{
'searchResult' : [{
'resultType' : 'station',
'ranking' : 0.5
}, {
'resultType' : 'station',
'ranking' : 0.4
}, {
'resultType' : 'station',
'ranking' : 0.35
}
]
}
Tried the code without success
result = sorted(result.items(), key=lambda k: k[1][0][1]["ranking"], reverse=True)