Level 16
Aug 15, 2018
3
Level 4
How TO convert this XML to Json
<ns2:spTransferToMobileNumberResponse xmlns:ns2="URL" xmlns:ns3="URL" xmlns:ns1="URL" xmlns:ns5="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ns2:responseCode>00</ns2:responseCode>
<ns2:responseMessage>Approved or completed Successfully</ns2:responseMessage>
<ns2:responseTime>2018-08-16T05:08:03+02:00</ns2:responseTime>
<ns2:transactionNumber>20180816_00040670000948</ns2:transactionNumber>
<ns2:referenceNumber>250788256379</ns2:referenceNumber>
<ns2:acknowledgementNumber>1254356</ns2:acknowledgementNumber>
<ns2:amountPaid>100</ns2:amountPaid>
<ns2:description>sendernote</ns2:description>
</ns2:spTransferToMobileNumberResponse>```
I tried ``` $simpleXml = simplexml_load_string($fileContents);``` and
```json_encode($simpleXml)```
But it is not working the funy thing is that it work for other XML and When I try this online tool ```https://www.freeformatter.com/xml-to-json-converter.html``` it format it in JSON, seems like I am missing something can anyone help me.
Please or to participate in this conversation.