XML to JSON Converter - Free & Browser Based
Turn XML, SOAP responses and RSS feeds into JSON. Attributes get their own prefix, repeated tags become arrays, and the parsing happens in your own browser.
Mapping XML documents onto JSON structures
XML and JSON do not describe the same shapes, so any converter has to make choices and state them plainly. Here an element becomes an object, its attributes are stored under a configurable prefix that defaults to the at sign, and the character data inside an element that also carries attributes lands under the key hash text. Two or more sibling elements sharing a tag name collapse into an array. An element with no attributes and no children becomes a plain string.
Integration developers are the heaviest users, usually because something old is talking to something new. A SOAP endpoint at a bank or an insurer returns an envelope wrapped in namespaces, and the service consuming it expects a flat JSON body. The same problem shows up with RSS and Atom feeds, sitemap files, IPTC news exchange documents, bank statements in CAMT format, and the XML export buttons that older ERP systems still put next to every report.
Parsing uses the same strict XML reader that powers the ToolForte API and MCP server, so the page and the API give you identical JSON for the same document. When a document is not well formed the reader stops and reports what it expected and the line where it gave up. That is usually an unclosed tag, a stray ampersand, or a byte order mark sitting in front of the declaration.
Namespace handling deserves a moment of thought. Dropping prefixes turns soap colon Envelope into Envelope, which produces the short keys most application code wants, but it will merge two elements that share a local name while belonging to different namespaces. Keeping the prefixes preserves that distinction at the cost of keys containing a colon, which then need bracket notation in JavaScript. Choose keeping them whenever the source document mixes vocabularies from several schemas.
Text nodes are trimmed, comments and processing instructions are dropped, and CDATA sections are read as ordinary text, so markup you escaped on purpose arrives intact. If the result needs reshaping afterwards, the JSON Formatter on ToolForte will pretty print or validate it, and the XML Formatter is the faster stop when all you really wanted was readable indentation in the original document.
How the XML to JSON Converter Works
- 01Paste an XML document or drop an .xml file into the input box. RSS, SOAP envelopes, sitemaps and SVG all count as XML here.
- 02Set the attribute prefix, decide whether namespace prefixes should be kept or dropped, and choose pretty printed or minified output.
- 03The DOMParser built into your browser reads the document, and the resulting tree is walked to produce objects, arrays and strings.
- 04Copy the JSON or download it. If the document is malformed the parser message is shown with the line and column where it stopped.
The mapping rules, spelled out
XML carries information in three places at once: element names, attributes, and character data. JSON has only keys and values, so a converter must decide how to fold three channels into two, and the rules matter more than they first appear. Here each element becomes an object whose keys are its child element names. Attributes are stored under the same object with a configurable prefix, an at sign by default, which keeps them from colliding with a child element of the same name. When an element carries attributes and text but no children, the text is filed under the key hash text, since the object slot is already taken. When an element has neither attributes nor children, it collapses to a plain string, which is what makes converted RSS and sitemap files pleasant to work with. Repetition is the other trap. XML expresses a list by repeating a tag, so two elements named item become an array while a single element named item stays a bare object. Code that consumes the result has to handle both shapes, which is why importers usually normalise with a helper that wraps a non array in an array. Comments and processing instructions are discarded, CDATA sections are read as ordinary text, and whitespace around text nodes is trimmed.
When to Use the XML to JSON Converter
It earns its place whenever a legacy interface meets modern code. SOAP endpoints at banks, insurers and government agencies still answer in namespaced envelopes, older ERP and accounting systems export XML reports, and syndication formats such as RSS and Atom are XML by definition. Converting to JSON lets you inspect the payload in a browser console, write assertions in a test, or hand the data to a frontend that has never seen an XML parser. It is also the quickest way to understand an unfamiliar schema, because the JSON shape shows you which elements repeat.
Common Use Cases
- Reading a SOAP response from a legacy billing or pension system in a modern JavaScript client.
- Turning an RSS or Atom feed into records for a static site build.
- Extracting product data from an XML supplier feed before importing it into a shop.
- Formatting the JSON you get out so it is easy to scan → JSON Formatter & Validator
- Indenting the original document when readability is the real problem → XML Formatter
Expert Tips
- Change the attribute prefix to an underscore if the JSON has to travel through a system that treats an at sign in a key as special, such as certain template engines and query languages.
- Very large documents are held entirely in memory as a DOM tree before conversion, so a file above roughly ten megabytes is better split or streamed with a command line tool.
- Mixed content, meaning text and child elements interleaved inside the same element, loses its ordering in JSON. If the order matters, keep the XML and query it with XPath instead of converting.
Frequently Asked Questions
Should I drop namespace prefixes or keep them?→
Why did a single repeated element not become an array?→
The parser reports an error on the first line of a valid file. What now?→
Are attribute values converted to numbers?→
Related tools
12 suggested- 01YAML to JSON Converter - Free & PrivateConvert YAML to JSON online. Nested maps, sequences, inline flow style, comments and block scalars, with line numbered errors. Free and browser based.
- 02JSON to YAML Converter - Free & PrivateConvert JSON to YAML in your browser with correct indentation, smart quoting and block scalars for multi line text. Free, private, nothing uploaded.
- 03HTTP Headers Checker - Free Response ViewerSee the status code, redirect chain and every response header for any URL, plus a free pass or fail audit of the six key security headers.
- 04DNS Lookup - A, MX, TXT, NS & MoreQuery A, AAAA, MX, TXT, NS, CNAME, SOA, and CAA records for any domain via DNS-over-HTTPS. Free browser-based DNS lookup with a query-all mode.
- 05ZIP Extractor - Open ZIP Files OnlineOpen and extract ZIP files directly in your browser: list contents, preview text and images, download files. Free and private - nothing is uploaded.
- 06Archive Converter and Extractor - ZIP, 7z, RAR, TAR, GZOpen ZIP, 7z, RAR, TAR, TAR.GZ, GZ, BZ2 and XZ archives in your browser, download the files, convert between ZIP, 7z, TAR and TAR.GZ, or create a new archive. Nothing is uploaded.
- 07Video and Audio Converter - MP4, WebM, MP3, GIF, Trim, CompressConvert MOV, AVI, MKV and WebM to MP4, extract MP3 or WAV, compress a video, trim a clip, make a GIF, remove silence and normalise loudness. FFmpeg runs in your browser, nothing is uploaded.
- 08User Agent Parser - Browser & OS LookupParse any user agent string to identify browser, version, engine, OS, and device type, including bots. Free, instant, and fully browser-based.
- 09HTML to JSX Converter - Free & InstantConvert HTML to valid React JSX instantly: className, camelCase attributes, style objects, and self-closed tags. Free, browser-based, and private.
- 10.htaccess Redirect Generator - Apache & NginxGenerate 301 and 302 redirect rules for Apache .htaccess and Nginx, with HTTPS, www, and trailing-slash templates. Free and fully browser-based.
- 11Generate .env.example Files - Free & PrivatePaste a .env file and instantly get a .env.example with secret values stripped. Free, browser-based, and private - credentials never leave your device.
- 12JSON Formatter & Validator - Instant ResultsFormat, validate, and minify JSON with instant error highlighting. Pinpoints syntax errors. Free, private, browser-based.
From the blog
Further reading- 15 Free Developer Tools Every Programmer Should BookmarkFormat JSON, encode Base64, test regex, decode JWTs, and more. Fifteen browser-based developer tools that run locally with no installation required.11 min read
- Best Free Online Developer Tools in 2026The best free online developer tools for 2026: JSON formatters, regex testers, API builders, and code converters. All browser-based, no install.9 min read
- Developer Utilities: SQL, YAML, JSON, and Code MinificationFormat SQL queries, convert YAML to JSON, work with XML, and minify HTML, CSS, and JavaScript for production. Essential browser-based dev tools.10 min read