You need to sign in to do that
Don't have an account?

How to Convert(Serialize) XML into JSON format?
Hi All,
This is my sample XML data. I want to convert(Serialize) XML into JSON. Iam doing like this If am wrong please let me know.
String xml= ' <?xml version="1.0" encoding="utf-16"?>
<GETmethod xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Extend />
<Successful>true</Successful>
<CustAllowed>
<CustomerAllow>
<SampleData />
<CurrentDate>10/14/2015</currentDate>
<DocID>296</DocID>
<DType>BP</CIDType>
</CustAllow>
</CustAllowed>
</GetMethod>';
String JSONString = JSON.serialize(xml);
I want to post it into future method, like below. will it take as JSON format or String format?
==> CalloutMethod(JSONString)
@future(callout=true)
public static void CalloutMethod(JSONString)
{
//Code
}
[1] https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_xml_dom.htm