I noticed that certain code that evaluates some shoe sizes for an e-commerce site and outputs them on screen is messing up the order in Chrome.
JSON given can be:
My keys were too important for me to convert them to strings. Instead I created another array which just maintained the order of the keys.
<?php
$origArray = valueReturnedFromFunction();
$preservedOrder = array_keys($origArray);
?>
<script>
var origArray = <?php echo json_encode($origArray)?>;
var preservedOrder = <?php echo json_encode($preservedOrder )?>;
for(i in preservedOrder){
var item = origArray[i];
...
}
</script>