Module - Converters (JS, JSON, XML...)
Collection of conversion functions between two formats such as JS, JSON, XML.
Activities
Convert a JavaScript (JS) object to an XML string. XML to JS will do the opposite.
| Technical Name |
Type |
Minimal Agent Version |
| js2xml |
synchronous
|
WIN-3.24, MAC-3.24, CLOUD-3.34
|
Input Parameters:
| Name |
Type |
Attributes |
Default |
Description |
| js |
any |
mandatory
|
|
Use the 'js' input parameter to specify the JavaScript (JS) object to convert to an XML string. |
Output Parameters:
| Name |
Type |
Description |
| xml |
string |
XML string. |
Sample Code:
const res = irpa_core.converter.js2xml({ foo: 'bar' });
Convert a JSON string to an XML string. XML to JSON will do the opposite.
| Technical Name |
Type |
Minimal Agent Version |
| json2xml |
synchronous
|
WIN-3.24, MAC-3.24, CLOUD-3.34
|
Input Parameters:
| Name |
Type |
Attributes |
Default |
Description |
| json |
string |
mandatory
|
|
Use the 'json' input parameter to specify the JSON string to convert to an XML string. |
Output Parameters:
| Name |
Type |
Description |
| xml |
string |
XML string. |
Sample Code:
const json = '{ "name":{"_text":"Ali"} "age":{"_text":"30"} }'; const res = irpa_core.converter.json2xml(json);
Convert an XML object or string to a JavaScript (JS) object. JS to XML will do the opposite.
| Technical Name |
Type |
Minimal Agent Version |
| xml2js |
synchronous
|
WIN-3.24, MAC-3.24, CLOUD-3.34
|
Input Parameters:
| Name |
Type |
Attributes |
Default |
Description |
| xml |
string |
mandatory
|
|
Use the 'xml' input parameter to specify the XML object or string to convert to a JavaScript (JS) object. |
Output Parameters:
| Name |
Type |
Description |
| obj |
any |
JavaScript (JS) object. |
Sample Code:
const xml = '<?xml version="1.0" encoding="utf-8"?>' + '<note importance="high" logged="true">' + ' <title>Happy</title>' + ' <task>Work</task>' + ' <task>Play</task>' + '</note>'; const res = irpa_core.converter.xml2js(xml, options);
Convert an XML object or string to a JSON string. JSON to XML will do the opposite.
| Technical Name |
Type |
Minimal Agent Version |
| xml2json |
synchronous
|
WIN-3.24, MAC-3.24, CLOUD-3.34
|
Input Parameters:
| Name |
Type |
Attributes |
Default |
Description |
| xml |
string |
mandatory
|
|
Use the 'xml' input parameter to specify the XML object or string to convert to a JSON string. |
Output Parameters:
| Name |
Type |
Description |
| text |
string |
JSON string. |
Sample Code:
const xml = '<?xml version="1.0" encoding="utf-8"?>' + '<note importance="high" logged="true">' + ' <title>Happy</title>' + ' <task>Work</task>' + ' <task>Play</task>' + '</note>'; const res = irpa_core.converter.xml2json(xml);