title: Getting JSON data with AJAX and converting to array of strings
body: <p>I'm trying to get my data into an array of strings so that I can use it as a dataset for jquery autocomplete.  What I'm getting now is an array of objects, which I don't think will work.</p>
  
  <p>Jquery on my main page:</p>
  
  <pre><code>$.get("get_schools.php", function(data) {
                 var results = jQuery.parseJSON(data);
                 alert(results);
  });
  </code></pre>
  
  <p>This results in data in the format of:
  [object Object],[object Object],[object Object]</p>
  
  <p>On get_schools.php:
  I query a database and the return the results to an array called $displaynames.  Then:</p>
  
  <pre><code>echo json_encode($displaynames);
  </code></pre>
  
  <p>Which looks like:
  [{"DisplayName":"XXXX Street Middle School"},{"DisplayName":"XXXXX Schools"},{"DisplayName":"XXXX Elementary School"}</p>
  
  <p><strong>UPDATE:</strong>
  this question has been flagged as a possible duplicate, but the other question pertains to getting a property of an object.  i wasn't attempting to get a property of an object.  i was attempting to convert an object array to an array of strings.  i needed the property names as well as the values in the result.  the other question only returns the values.</p>