code: function readXmlAsJson(filePath) {
    var xmlData;
    var xmlParser;
    var parsedData;
  
    try {
      xmlData = fs.readFileSync(filePath, 'utf8');
      xmlParser = new xml2js.Parser();
      xmlParser.parseString(xmlData, function(err, data) {
        if (data) {
          parsedData = data;
        }
      });
    } catch (err) {}
  
    return parsedData;
  }
docs: Read data from the xml file as JSON object.
  
  @param {String} filePath - absolute path to xml file
  @return {Object} JSON object with the contents of the xml file