<?php $types=[['id'=>0],['id'=>1]]; ?><script> var types=<?php echo json_encode($types); ?>; console.log(types); </script>