1

I have a interesting problem. I am working on an object which returns from my webapi in json format.

JSON Object

{"3852":20.0,"2852":20.0,"1852":59.0}

Above code is my original json code. It is auto-sorted when I run the code below on it, however:

JSON.parse('{"3852":20.0,"2852":20.0,"1852":59.0}')

I don't want it to be sorted when I run the json.parse function.

hat
  • 781
  • 2
  • 14
  • 25
muratoner
  • 2,316
  • 3
  • 20
  • 32
  • Numeric keys in javascript objects get sorted by default. There is no guaranteed order in objects. Use array if you need order – charlietfl Apr 03 '19 at 11:36

0 Answers0