title: Convert Multidimensional PHP array to javascript array
body: <p>I'm trying to convert a PHP multidimensional array to a javascript array using the JSON encoder. When I do a var_dump, my php array looks like this:</p>
  
  <pre><code>array (size=2)
    'Key' =&gt; string 'a' (length=1)
    'Value' =&gt; string 'asite.com' (length=9)
  </code></pre>
  
  <p>This is the code I'm currently using in my view to try to convert it to a JavaScript array:</p>
  
  <pre><code>var tempArray = $.parseJSON(&lt;?php echo json_encode($php_array); ?&gt;);
  </code></pre>
  
  <p>Whenever I run this code in the browser, the output of the conversion in the console is this:</p>
  
  <pre><code>var tempArray = $.parseJSON([{"Key":"a","Value":"asite.com"}]);
  </code></pre>
  
  <p>Is this the correct structure for a javascript multidimensional array? I'm asking because it keeps giving me this error on the line above: </p>
  
  <p><code>SyntaxError: Unexpected token o</code></p>