title: How to convert SOAP API response from XML to JSON
body: <pre><code>&lt;s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"&gt;
      &lt;s:Body&gt;
          &lt;GetCategoriesJsonResponse xmlns="http://tempuri.org/"&gt;
          &lt;GetCategoriesJsonResult&gt;[{"code":"0","description":"Sides","storeNumber":"3733"},{"code":"1","description":"Sandwiches","storeNumber":"3733"},&lt;/GetCategoriesJsonResult&gt;
          &lt;/GetCategoriesJsonResponse&gt;
      &lt;/s:Body&gt;
  &lt;/s:Envelope&gt;
  </code></pre>
  
  <p>That is the result of the API, but I want to convert it like:</p>
  
  <pre><code>[
      {
          "code": "0",
          "description": "Sides",
          "storeNumber": "3733"
      },
      {
          "code": "1",
          "description": "Sandwiches",
          "storeNumber": "3733"
      },
  ]
  </code></pre>
  
  <p>How can I do this? I've tried <code>json_encode</code> and <code>json_decode</code> but it didn't work for me. I have applied different methods to convert it but it's still showing XML results. Can anyone tell me how I can convert it into JSON?</p>