NodeJS XML to JSON using XML2JS https://embarkcode.com/nodejs-xml-to-json/
const xml2js = require('xml2js'); | |
const xml = '<root>Hello world!</root>' | |
xml2js.parseString(xml, function (err, result) { | |
console.log(result.root); // Output: Hello world! | |
const json = JSON.stringify(result); | |
console.log(json); // Output: {"root":"Hello world!"} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment