title: formatting JSON array output via
body: <p>I am writing a small service in php to output a JSON string. The service is ultimately consumed by an Android JSONObject, if that helps. To keep it short, I have:</p>
  
  <pre><code>&lt;?php
  mysql_connect('localhost','myUser','myPwd') or die('Cannot connect to the DB');
  mysql_select_db('ctgscott_myDB') or die('Cannot select the DB');
  $query=mysql_query("SELECT name FROM customers ORDER BY name ASC");
  
  while($e=mysql_fetch_assoc($query))
  $output[]=$e;
  print(json_encode($output));    
  
  mysql_close();
  </code></pre>
  
  <p>?></p>
  
  <p>The problem is the output arrives in the form:</p>
  
  <pre><code>[{"name":"Client Number1"},{"name":"Client Number2"}]
  </code></pre>
  
  <p>'name' is the column header for the name field in the 'customer' table and it is unnecessary for me to repeat it... I am struggling to format the output like:</p>
  
  <pre><code>{"name":["Client Number1","Client Number2"]}
  </code></pre>
  
  <p>Any help would be greatly appreciated.  Thanks!</p>