On the backend form json:
$conditions = json_encode(array( '3' => array('three'), '2' => array('two'), '1' => array('one'), )); I save in the page element attribute:
<div id="data" data-value="{"3":["three"],"2":["two"],"1":["one"]}"> The order of the elements of the array is preserved. But when I read this json in javascript, I get an object sorted by keys. Can this be somehow avoided or the only option is to change the keys of the source array in the order I need?
<script> console.log(data.dataset.value); // Object { 1: Array[1], 2: Array[1], 3: Array[1] } </script>
['3','2','1']- Mikearray_keys()and that's it. - toxxxa 5:57 pm