title: convert sqlite data to json using php
body: <p>I'm trying to convert sqlite query into json. I have the following table with two columns name and age. When I print the query the format doesn't seem to be correct. why am I getting an extra key value pair?</p>
  
  <pre><code>&lt;?php
  $db = new SQLite3('info.db');
  
  $results = $db-&gt;query('SELECT * FROM info');
  while ($row = $results-&gt;fetchArray()) {
  
      $jsonArray[] = $row;
  }
  
  echo json_encode($jsonArray)
  ?&gt;
  </code></pre>
  
  <p>output</p>
  
  <pre><code>[{"0":"billy","name":"billy","1":"20","age":"20"}]
  </code></pre>
  
  <p>desired output</p>
  
  <pre><code>    [{"name":"billy","age":"20"}]
  </code></pre>