2021年2月7日星期日

Sorting JSON file elements? [duplicate]

I have a JSON file which looks like this:

{"players":[{"username":"name1","score":36},{"username":"name2","score":8},{"username":"name3","score":1},{"username":"name4","score":18}]}  

I want to sort it out so it's in descending order by scores. I tried with forEach and with .sort but I didn't succeed.

https://stackoverflow.com/questions/66094982/sorting-json-file-elements February 08, 2021 at 09:51AM

没有评论:

发表评论