Sample Code for XML-to-JSON and JSON-to-XML Conversion

 import PT_INTEGRATION:CIRESTDefinition;


Local PT_INTEGRATION:CIRESTDefinition &oConvert = create PT_INTEGRATION:CIRESTDefinition();

Local string &sJSON, &sXML;

Local XmlDoc &xmlDoc, &retXmlDoc;


&sXML = GetHTMLText(HTML.XPPHTMLX);

&xmlDoc = CreateXmlDoc(&sXML);

&sJSON = &oConvert.convertXMLtoJSON(&xmlDoc);

WinMessage(&sJSON, 64);

REM XPPJSONX - create an HTML object and paste the JSON from above into this HTML so that it can be compared with the original XML;

&retXmlDoc = &oConvert.convertJSONtoXML(GetHTMLText(HTML.XPPJSONX));

WinMessage(&retXmlDoc.GenFormattedXmlString(), 64);

No comments:

Post a Comment

Excel to Component Interface Utility

  To use the Excel to Component Interface utility, you must grant access to the iScript WEBLIB_SOAPTOCI in the permission list of the user w...