var parser = require('xml2json'); const fs = require('fs'); fs.readFile( 'nodesets/Opc.Ua.Machinery.NodeSet2.xml', function(err, data) { var json = parser.toJson(data); //console.log("to json ->", json); // json to xml //var xml = parser.toXml(json); //console.log("back to xml -> %s", xml) //let daten = JSON.stringify(json); fs.writeFileSync('machinery.json', json); });