0

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.

1 Answers1

0

maybe you can try by using lodash

_.orderBy(arr, ['username'], ['desc'])
Nick
  • 138,499
  • 22
  • 57
  • 95
Li Xing
  • 111
  • 3
  • 12