I have an example JSON file consisting of:
{
"119996306407030785": {
"duel": {
"class": "mage",
"totalDamage": 64,
"wins": 5,
"losses": 2
},
"weather": {
"location": "46544"
}
},
"119333755579138048": {
"duel": {
"class": "rogue",
"totalDamage": 35,
"losses": 1,
"wins": 2
},
"weather": {
"location": "95825"
}
},
"112006834713329664": {
"duel": {
"totalDamage": 33,
"losses": 1,
"wins": 7
}
}
}
119996306407030785
is a userID. I'd like to sort the return by the highest duel.wins of all users for a "top 5" concept.
The output I would like with the above JSON would be:
112006834713329664 - 7 wins
119996306407030785 - 5 wins
119333755579138048 - 2 wins
I've seen multiple questions close to this one while Googling, but can't find any that have JSON similar to my setup.
Is this possible considering how my userID's are setup & how random they are? If so, how can it be done? Please take note that I would not only need the return of the # of wins, but also the userID correlating to that win amount. I would also like to only return the top 5 even if there are dozens of userID's.