Issue
As an AppSmith user, I need to be able to convert JSON to XML and XML to JSON within my application. To achieve this, the fast-xml-parser library has been integrated into the application and can be accessed through the xmlParser keyword. The library offers a jsonToXML function to convert JSON to XML and an xmlToJSON function to convert XML to JSON.
Resolution
fast-xml-parser 1 is integrated inside AppSmith and accessible through xmlParser
keyword. Here is a JS Object:
export default {
_J2Xparser: new xmlParser.j2xParser(),
jsonToXML: (json = {"abc": "def"}) => {
return this._J2Xparser.parse(json);
},
xmlToJSON: (xmlString = "<abc>def</abc>") => {
return xmlParser.parse(xmlString);
}
}