title: How to understand/consume json output from PHP script
body: <p>Using PHP PDO I run this query</p>
  
  <pre><code>SELECT Name, Latitude, Longitude, Begin, End FROM VenueData
  </code></pre>
  
  <p>And fetch the data</p>
  
  <pre><code>$data = $sth-&gt;fetchAll();
  </code></pre>
  
  <p>Then output</p>
  
  <pre><code>header("Content-type: application/json");
  print(json_encode(array('venues'=&gt;$data)));
  </code></pre>
  
  <p>However the output is strange,</p>
  
  <pre><code>{"venues":[{"Name":"Flintstone1","0":"Flintstone1","Latitude":"57","1":"57","Longitude":"-124","2":"-124","Begin":"8","3":"8","End":"14","4":"14"}]}
  </code></pre>
  
  <p>It seems for every column in the select query there are 2 keys, one by name and one by index 0-n) in the json. I have not encountered this before, why is this happening?</p>