Reputation: 1097
I know this has been talked about and I have tried many examples with no avail. Guessing I have a no win here but I want one last go at it, so I'll ask good old StackOverflow.
Here is an example STRING I have
{"X":"545","20":"1","22":"1","25":"1","26":"1","27.5":"1","28.5":"1","29.875":"1","32":"1"}
When I stuff this in to an object using eval or parseJSON I get the following object
Opera, FF, Chrome, Safari
{"X":"545","20":"1","22":"1","25":"1","26":"1","27.5":"1","28.5":"1","29.875":"1","32":"1"}
Ie 7-9
{"20":"1","22":"1","25":"1","26":"1","32":"1","X":"545","27.5":"1","28.5":"1","29.875":"1"}
Now I know per definition there is no way to ensure an order. However every browser does maintain the order but good old IE. And we need IE to play fair.
Any thoughts on this?
Upvotes: 1
Views: 83
Reputation: 12389
Use an array for an ordered set of values.
By definition an Object is unordered. But you can still get your values by calling the right property, so it shouldn't matter much if you code accordingly.
Upvotes: 1