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
🌐
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%
🌐
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.
People also ask

Is this XML to JSON converter free?
Yes! Our XML to JSON converter is completely free to use, with no sign-up or installation required.
🌐
lambdatest.com
lambdatest.com › home › free tools › xml to json converter
XML to JSON Converter Online | Free XML to JSON Tool
What is an XML to JSON converter?
An XML to JSON converter is a tool that transforms XML data into JSON format. It helps developers and testers work with modern applications, APIs, and databases that primarily use JSON.
🌐
lambdatest.com
lambdatest.com › home › free tools › xml to json converter
XML to JSON Converter Online | Free XML to JSON Tool
What are the benefits of converting XML to JSON?
JSON is lighter, faster, and easier to use in modern web and mobile apps. Converting XML to JSON improves compatibility with REST APIs, frontend frameworks, and JavaScript-based projects.
🌐
lambdatest.com
lambdatest.com › home › free tools › xml to json converter
XML to JSON Converter Online | Free XML to JSON Tool
🌐
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
🌐
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.
🌐
Online XML Tools
onlinexmltools.com › convert-xml-to-json
Convert XML to JSON - Online XML Tools
Simple, free and easy to use online tool that converts XML to JSON. No ads, popups or nonsense, just an XML to JSON converter. Load XML, get JSON.
🌐
JSON Formatter
jsonformatter.org › xml-to-javascriptproptypes
Best XML to JavaScript PropTypes Converter to convert JavaScript PropTypes Code.
Load Data XML to Javascriptproptypes Download · × · Load URL · Upload File · Close · × · DownloadUpdateSave OnlineCloseErrorDialog ·
🌐
LambdaTest
lambdatest.com › home › free tools › xml to json converter
XML to JSON Converter Online | Free XML to JSON Tool
This free tool allows you to quickly convert XML to JSON online, giving you clean, structured output in seconds.
Find elsewhere
🌐
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
🌐
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
🌐
Utilities and Tools
utilities-online.info › xmltojson
XML to JSON & JSON to XML converter online
Every single JSON property value will be converted to #item types. A specific default root element is created and the offending characters will be XML escaped. The given array entries are converted to individual XML elements. This online converter is a completely free and easy-to-use tool to convert XML to JSON format and vice versa.
🌐
Code Beautify
codebeautify.org › xmltojson
XML to JSON Converter Online to convert XML to JSON String, URL and File
If you're looking for an easy way to convert XML to JSON, you've come to the right place. Our XML to JSON converter is free and easy to use, simply paste your XML code into the input and hit the "XML to JSON" button.
🌐
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
🌐
SourceForge
sourceforge.net › projects › xml2js.mirror
xml2js download | SourceForge.net
August 21, 2025 - Download xml2js for free. XML to JavaScript object converter. xml2js is a Node.js module that converts XML into JavaScript objects (and vice versa). It simplifies XML parsing by using pure JavaScript and supports both synchronous and asynchronous ...
🌐
npm
npmjs.com › package › xml2js
xml2js - npm
Simple XML to JavaScript object converter.. Latest version: 0.6.2, last published: 3 years ago. Start using xml2js in your project by running `npm i xml2js`. There are 10737 other projects in the npm registry using xml2js.
      » npm install xml2js
    
Published   Jul 26, 2023
Version   0.6.2
Author   Marek Kubica
🌐
Minifier
minifier.org › xml-to-html
Minify JS and CSS online, or include the minifier in your project for on-the-fly compression.
Moreover, we also use the xml2js library to parse and manipulate XML data properly. Once in JSON format, the data is further processed into CSV using in-house conversion scripts, and then finally converted into an HTML table.
🌐
n8n
n8n.io › tools › xml-to-json
XML to JSON Converter - Free and Easy Conversion | n8n
Easily convert XML to JSON for free. Paste XML plain text or upload XML file. Download or save JSON.
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › how-to-convert-xml-to-json-in-javascript
How to Convert XML to JSON in JavaScript? - GeeksforGeeks
July 23, 2025 - It traverse the parsed XML document's nodes to extract element names and their corresponding text content, storing them in a JSON object for conversion and formatting. ... Example: Parses the given XML string to a JavaScript object using xmldom and ...
🌐
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.