title: How to get the json format of data from prestashop web service
body: <p>I need to return the json format of data for client request. I used prestashop 1.6 and enabled the web services and created the authkey.
  I am using below code </p>
  
  <pre><code>&lt;?php
  define('DEBUG', true);                                          // Debug mode
  define('PS_SHOP_PATH', 'http://www.example.com');       // Root path of your PrestaShop store
  define('PS_WS_AUTH_KEY', 'myauthkey');  // Auth key (Get it in your Back Office)
  require_once('PSWebServiceLibrary.php');
  
  try
  {
      $webService = new PrestaShopWebservice(PS_SHOP_PATH, PS_WS_AUTH_KEY, DEBUG);
  
      // Here we set the option array for the Webservice : we want customers resources
      $opt['resource'] = 'categories';
  
      $opt['output_format'] = 'JSON';
  
      $opt['ps_method']   = 'GET';
  
      // Call
      $output = $webService-&gt;get($opt);
     echo $output;
  }
  catch (PrestaShopWebserviceException $e)
  {
      // Here we are dealing with errors
      $trace = $e-&gt;getTrace();
      if ($trace[0]['args'][0] == 404) echo 'Bad ID';
      else if ($trace[0]['args'][0] == 401) echo 'Bad auth key';
      else echo 'Other error';
  }
  ?&gt;
  </code></pre>
  
  <p>But it returns like </p>
  
  <pre><code>HTTP RESPONSE HEADER
  HTTP/1.1 200 OK
  Date: Thu, 21 May 2015 10:37:18 GMT
  Server: Apache/2.4.10 (Unix) OpenSSL/1.0.1e-fips mod_bwlimited/1.4
  Access-Time: 1432204638
  X-Powered-By: PrestaShop Webservice
  PSWS-Version: 1.6.0.14
  Execution-Time: 0.012
  Content-Sha1: 39de35d56851e6fb74644c38ffcb34215d63822f
  Vary: Accept-Encoding
  Cache-Control: max-age=3600
  Expires: Thu, 21 May 2015 11:37:18 GMT
  Transfer-Encoding: chunked
  Content-Type: text/xml;charset=utf-8
  RETURN HTTP BODY
  &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;prestashop xmlns:xlink="http://www.w3.org/1999/xlink"&gt;
  &lt;categories&gt;
  &lt;category id="1" xlink:href="http://www.example.com/api/categories/1"/&gt;
  &lt;category id="2" xlink:href="http://www.example.com/api/categories/2"/&gt;
  &lt;category id="57" xlink:href="http://www.example.com/api/categories/57"/&gt;
  &lt;category id="58" xlink:href="http://www.example.com/api/categories/58"/&gt;
  &lt;/categories&gt;
  &lt;/prestashop&gt;
  object(SimpleXMLElement)#2 (1) { ["categories"]=&gt; object(SimpleXMLElement)#3 (1) { ["category"]=&gt; array(17) { [0]=&gt; object(SimpleXMLElement)#4 (1) { ["@attributes"]=&gt; array(1) { ["id"]=&gt; string(1) "1" } } [1]=&gt; object(SimpleXMLElement)#5 (1) { ["@attributes"]=&gt; array(1) { ["id"]=&gt; string(1) "2" } } [2]=&gt; object(SimpleXMLElement)#6 (1) { ["@attributes"]=&gt; array(1) { ["id"]=&gt; string(2) "57" } } [3]=&gt; object(SimpleXMLElement)#7 (1) { ["@attributes"]=&gt; array(1) { ["id"]=&gt; string(2) "58" } } [4]=&gt; object(SimpleXMLElement)#8 (1) { ["@attributes"]=&gt; array(1) { ["id"]=&gt; string(2) "59" } } [5]=&gt; object(SimpleXMLElement)#9 (1) { ["@attributes"]=&gt; array(1) { ["id"]=&gt; string(2) "60" } } [6]=&gt; object(SimpleXMLElement)#10 (1) { ["@attributes"]=&gt; array(1) { ["id"]=&gt; string(2) "61" } } [7]=&gt; object(SimpleXMLElement)#11 (1) { ["@attributes"]=&gt; array(1) { ["id"]=&gt; string(2) "62" } } [8]=&gt; object(SimpleXMLElement)#12 (1) { ["@attributes"]=&gt; array(1) { ["id"]=&gt; string(2) "63" } } [9]=&gt; object(SimpleXMLElement)#13 (1) { ["@attributes"]=&gt; array(1) { ["id"]=&gt; string(2) "64" } } [10]=&gt; object(SimpleXMLElement)#14 (1) { ["@attributes"]=&gt; array(1) { ["id"]=&gt; string(2) "65" } } [11]=&gt; object(SimpleXMLElement)#15 (1) { ["@attributes"]=&gt; array(1) { ["id"]=&gt; string(2) "66" } } [12]=&gt; object(SimpleXMLElement)#16 (1) { ["@attributes"]=&gt; array(1) { ["id"]=&gt; string(2) "67" } } [13]=&gt; object(SimpleXMLElement)#17 (1) { ["@attributes"]=&gt; array(1) { ["id"]=&gt; string(2) "68" } } [14]=&gt; object(SimpleXMLElement)#18 (1) { ["@attributes"]=&gt; array(1) { ["id"]=&gt; string(2) "69" } } [15]=&gt; object(SimpleXMLElement)#19 (1) { ["@attributes"]=&gt; array(1) { ["id"]=&gt; string(2) "70" } } [16]=&gt; object(SimpleXMLElement)#20 (1) { ["@attributes"]=&gt; array(1) { ["id"]=&gt; string(2) "71" } } } } }
  </code></pre>
  
  <p>how to return only json output without HTTP RESPONSE HEADER and RETURN HTTP BODY.</p>