I have an array in php:
<?php
return array(
'r' => '16:9',
'check' => array(
array('w' => 640, 'q' => 70),
array('w' => 960, 'q' => 70)
),
'window_height' => 800
);
I need to get this in my javascript, so I have:
<script>var config = "{{ json_encode(Config::get('conf')) }}";</script>
But im having trouble getting each element out.
Note: {{}} is laravel for echo.
json_encoded version of the array? Something likereturn json_encode($array).json_encode()should convert your associative array to an object (with nested arrays incheckproperty) as you desire.