Axess
Axess

Reputation: 101

Get values in order from JSON object

I have an object like:

{'2014-01-01': 123, '2014-01-02': 456, '2014-01-03': 678}

I only need the values, while I loop through the object to fetch values, the order of the values has been changed, just randomly.

How can I get the values in order exactly like the original one? Thank you!

Upvotes: 1

Views: 48

Answers (1)

zavg
zavg

Reputation: 11071

According to JSON specification, an object is an unordered set of name/value pairs, so it is impossible.

Upvotes: 1

Related Questions