title: Need to stringify? Confusion over format of data for posting array of objects from javascript to PHP
body: <p>I am trying to post an array of objects from jQuery/Javascript client script to server side PHP script.</p>
  
  <p>Im still confused about the <em>format</em> that the object array data should be in before reaching the server.</p>
  
  <p>I create an array to store the json objects</p>
  
  <pre><code>var jsonObjects = [];
  </code></pre>
  
  <p>I add individual json objects to the array</p>
  
  <pre><code>var jsonObj1 = {};
   jsonObj1.place = "London";
   jsonObj1.position = 1;
  
   jsonObjects.push(jsonObj1);
  
   var jsonObj2 = {};
   jsonObj2.place = "Melbourne";
   jsonObj2.position = 2;
  
   jsonObjects.push(jsonObj2);
  </code></pre>
  
  <p>..etc</p>
  
  <p>I then try to post this data via ajax post (Ive tried stringifying before the post and also tried without stringifying)</p>
  
  <p>e.g.</p>
  
  <pre><code>//var data = jsonObjects;
  //var data = JSON.stringify(jsonObjects);
  
  jQuery.ajax({
              url: "/drupal/menu_item",
              type: 'POST',
              data: data
              dataType: 'json'
               });
  </code></pre>
  
  <p>Either way on the XHR tab in Firebug it just shows a stringified version of the data 
  e.g.
  [{"place":"London","position":"2"}, {"place":"Melbourne","position":"2"}]</p>
  
  <p>rather than it looking like what the post details have looked like before with the data broken up into parameters. Unless of course PHP finding data in the stringified state will actually work (?)</p>
  
  <p>I seem to be finding conflicting details as to how sending an array of json objects to PHP should be done. At the point that the ajax request is executed what state should the data be in?
  a) stringified array of objects
  b) array of objects
  c) something else again (?)</p>
  
  <p>Any help to clarify this is much appreciated :)</p>
  
  <p>Thanks,</p>
  
  <p>Rowan</p>