npm i js2xmlparser
index.js
1 2 3 4 5 6 7 8 |
const fs = require('fs'); const js2xmlparser = require('js2xmlparser'); const json = JSON.parse(fs.readFileSync('output.json')); const xml = js2xmlparser.parse("root", json); fs.writeFileSync('output.xml', xml); console.log('JSON to XML conversion complete!'); |