You can use this template to convert XML to/from JSON.
Convert XML to JSON
Simplifier.Util.xml2json(xml: string): string
Parses an XML string, converts it to JSON and returns the representing JSON string.
try{ var convertedJson = Simplifier.Util.xml2json("<xml></xml>"); output.json = convertedJson; output.message = "Convertion successful"; output.success = true; } catch (e) { output.message = e.message; output.success = false; }
Convert JSON to XML
Simplifier.Util.json2xml(json: string): string
Parses a JSON string, converts it to XML and returns the representing XML string.
try{ var convertedXML = Simplifier.Util.json2xml(JSON.stringify({attribute: "value"})); output.xml = convertedXML; output.message = "Convertion successful"; output.success = true; } catch (e) { output.message = e.message; output.success = false; }