Request parser best practices for Services 3.x When you create a service endpoint you can enable various request parsers (application/json, application/x-www-form-urlencoded, multipart/form-data...) How should I decide whether to send the request using JSON vs form-data?

Most of the "node create" examples I've seen do something like this (I think this uses form-data):

    //create a node
    $node_data = array(
                      "title"=&gt;"DHC Tool 01",
                      "type"=&gt;"item",

                      "status"=&gt;false, //ensure unpublished
                      "language" =&gt; "und", //lanugage neutral
                      "field_webpage"=&gt;array(
                                              "und"=&gt;array(
                                                            0=&gt;array("url"=&gt;"http://berkeley.edu",)
                                                           )
                                             )

                     );

  // Use JSON
  // $node_data = '{"title":"Tool Unpublished 10","type":"item","status":false,"language":"und","field_webpage":{"und":[{"url":"http:\/\/berkeley.edu"}]}}';
    $options['data'] = http_build_query($node_data, '', '&amp;');
    $response = drupal_http_request($base_url . '/node', $options);


Is there any advantage to sending the node create request using JSON? 

How would the above code be modified to use JSON?

Thanks!
This code will send a request encoded as JSON:

function toolreq_test_create() {
  $base_url = 'http://example.com/dirt';
  $options = toolreq_service_login(); //this yields $options['headers']['Cookie'] = $data-&gt;session_name . '=' . $data-&gt;sessid;
  if (!is_array($options)) {
    print "error&lt;p&gt;";
    return;
   }    

   //create a node
   $node_data = array(
     'title' =&gt; 'DHC Tool 03',
     'type' =&gt; 'item',
     'status' =&gt; FALSE, //ensure unpublished
     'language' =&gt; 'und', //lanugage neutral
     'field_webpage' =&gt; array(
       'und' =&gt; array(
         0 =&gt; array('url' =&gt; 'http://berkeley.edu',)
       )
     )
   );

   //use json
   $options['headers']['content-type'] = "application/json";
   $options['method'] = 'POST';
   $options['data'] = json_encode($node_data); 
   $request = drupal_http_request($base_url . '/node', $options);
   if ($request-&gt;error) {
     print ("Error doing http request");
     print '&lt;pre&gt;' . var_dump($request) . '&lt;/pre&gt;';
   }
   else {
     print ("Success doing http request");
     print '&lt;pre&gt;' . var_dump(json_decode($response-&gt;data)) . '&lt;/pre&gt;';
   }
 }


When considering the best format for your request keep in mind:


JSON is a useful format for Ajax applications because it allows you to convert between JavaScript objects and string values quickly. ref: http://www.ibm.com/developerworks/web/library/wa-ajaxintro11/index.html
https://stackoverflow.com/questions/4007969/application-x-www-form-urlencoded-or-multipart-form-data