I think this is the best one: Converting between XML and JSON

Be sure to read the accompanying article on the xml.com O'Reilly site, which goes into details of the problems with these conversions, which I think you will find enlightening. The fact that O'Reilly is hosting the article should indicate that Stefan's solution has merit.

Answer from Josh Stodola on Stack Overflow
🌐
npm
npmjs.com › package › xml-js
xml-js - npm
February 13, 2019 - Convert XML text to Javascript object / JSON text (and vice versa).
      » npm install xml-js
    
Published   Feb 13, 2019
Version   1.6.11
Author   Yousuf Almarzooqi
🌐
ConvertSimple
convertsimple.com › convert-xml-to-javascript-object
Convert XML to JavaScript Object Online - ConvertSimple.com
October 17, 2020 - Convert XML to a JavaScript object or array with this simple online XML to JavaScript converter tool.
🌐
GitHub
github.com › nashwaan › xml-js
GitHub - nashwaan/xml-js: Converter utility between XML text and Javascript object / JSON text.
TIP: In non-compact mode, you probably want to set {textKey: 'value', cdataKey: 'value', commentKey: 'value'} to make it more consistent and easier for your client code to go through the contents of text, cdata, and comment. For XML → JS object / JSON, following custom callback functions can be supplied: var convert = require('xml-js'); var xml = '<foo:Name>Ali</Name> <bar:Age>30</bar:Age>'; var options = {compact: true, elementNameFn: function(val) {return val.replace('foo:','').toUpperCase();}}; var result = convert.xml2json(xml, options); console.log(result); // {"NAME":{"_text":"Ali"},"BAR:AGE":{"_text":"30"}}
Starred by 1.3K users
Forked by 179 users
Languages   JavaScript 97.3% | CSS 1.4% | JavaScript 97.3% | CSS 1.4%
🌐
JSON Formatter
jsonformatter.org › xml-to-javascriptproptypes
Best XML to JavaScript PropTypes Converter to convert JavaScript PropTypes Code.
Secure XML to JavaScript PropTypes Converter. It easy to use and generated JavaScript PropTypes Code based on XML also Support XML File and URL.
🌐
Code Beautify
codebeautify.org › xml-to-javascript-pojo-generator
XML to JavaScript Function / Class Generator
Best XML to JavaScript POJO Generator which generates JavaScript Functions / Class code from valid XML data
🌐
Loco
localise.biz › free › converter › xml-to-js
Convert XML language packs to JavaScript
Free tool converts XML language packs including TMX translation files to JavaScript and JSON.
🌐
npm
npmjs.com › package › xml2js
xml2js - npm
Simple XML to JavaScript object converter. It supports bi-directional conversion. Uses sax-js and xmlbuilder-js.
      » npm install xml2js
    
Published   Jul 26, 2023
Version   0.6.2
Author   Marek Kubica
Find elsewhere
🌐
npm
npmjs.com › package › xml-js-converter
xml-js-converter - npm
July 12, 2015 - Define your own rules for how to convert attributes and content. Latest version: 1.0.0, last published: 11 years ago. Start using xml-js-converter in your project by running `npm i xml-js-converter`. There are no other ...
      » npm install xml-js-converter
    
Published   Jul 12, 2015
Version   1.0.0
Author   Dave Brotherstone
🌐
GitHub
github.com › commenthol › xml-vs-js
GitHub - commenthol/xml-vs-js: Convert XML/ HTML to Javascript and vice versa · GitHub
const {toJs} = require('xml-vs-js') const xml = ` <?xml version="1.0" encoding=utf-8 ?> <feed xmlns="http://www.w3.org/2005/Atom"> <title>Example Feed</title> <entry> <title>Entry</title> <link href="http://example.org/2003/12/13/atom03" /> <link rel="alternate" type="text/html" href="http://example.org/2003/12/13/atom03.html"/> </entry> <entry> <title>Update</title> </entry> </feed> ` toJs(xml, (err, obj) => { console.log(obj) /* { _elems: ['_PROCESSING', 'feed'], _PROCESSING: { _text: '?xml version="1.0" encoding=utf-8 ?' }, feed: { _attrs: { xmlns: 'http://www.w3.org/2005/Atom' }, _elems: [
Author   commenthol
🌐
FreeFormatter
freeformatter.com › xml-to-json-converter.html
Free Online XML to JSON Converter - FreeFormatter.com
This free online tool lets you convert an XML file into a JSON file with your choice of indentation
🌐
ReqBin
reqbin.com › xml-to-json
Online XML to JSON Converter
XML to JSON conversion is done right in the browser without sending requests to the server. The XML to JSON converter is simple and very easy to use with minimal configuration options. Enter XML data and click "Convert XML to JSON" to transform XML to JSON online and see the result.
🌐
Online XML Tools
onlinexmltools.com › convert-xml-to-json
Convert XML to JSON - Online XML Tools
Free online XML to JSON converter. Just paste your XML in the form below and it will automatically get converted to JSON. There are no ads, popups or nonsense, just an awesome XML to JSON converter. Paste XML, get JSON.
🌐
Code Beautify
codebeautify.org › xmltojson
XML to JSON Converter Online to convert XML to JSON String, URL and File
This tool allows loading the XML URL, which loads XML and turns into JSON String. Click on the URL button, Enter the URL and Submit. Users can also convert XML Files to JSON by uploading the file.
🌐
Node-RED Cookbook
cookbook.nodered.org › basic › convert-xml
Convert to/from XML : Node-RED
You want to convert a message property between an XML string and the JavaScript object it represents.
🌐
Teleport
goteleport.com › resources › tools › xml-to-json-converter
XML to JSON Converter | Instant XML to JSON Conversion | Teleport
Convert XML data to JSON instantly with our free online tool. Simplify your data conversions with fast, accurate processing.
🌐
David Walsh
davidwalsh.name › convert-xml-json
Convert XML to JSON with JavaScript
November 25, 2015 - Pretty good topic, i am working in a ios project that needed localization and all kinda of stuffs and coredata was a pain in the ass to make it work, so i have made a xml file for each language and for my surprise, nsxmlparser is a sax parser and it really sucks, so i converted my xml file in a json with this site: http://shlang.com/xml2json/
🌐
TestMu AI Community
community.testmuai.com › ask a question
How can you convert XML to JSON and then back to XML using JavaScript? - TestMu AI Community
April 22, 2025 - I’ve come across some tools like xml2json, but they aren’t always fully consistent. Has anyone else worked with javascript xml to json conversions and found a reliable approach?