Parsing and sending XML

To parse an XML string to a JS Object, follow these steps:

  • Open the Custom code tab of the app and specify the script:

<script src="" ></script>
  • in your action, add a new JavaScript step to process the result or activate the Transform result toggle to open the mapper field, and specify the code:

const xmlContent = atob({{data.base64}});
const parser = new XMLParser();
return parser.parse(xmlContent);

Sending XML from UI Bakery

To send an XML string from UI Bakery, follow these steps:

  • in the Custom code tab of the app, specify these scripts:

<script src="
<script src=""></script>
  • add a multistep action;

  • the first step will be a Code action that will generate an XML from JSON, assuming there is an action that returns data to be sent as XML:

const jsonData = await {{actions.requestData.trigger()}};
return jstoxml.toXML(jsonData);
  • the second step will send a request. You need to specify a header Content-Type application/xml,

and the Body of the request is the result of the first JavaScript step:

Last updated