Free Online Tool

XML to JSON Converter — Free, Instant, CDATA-Safe

Paste an XML document and get clean JSON in the same second. Attributes, repeated elements and CDATA blocks all survive the conversion, and your file never leaves your browser.

Converts as you type100% private, no uploadsCDATA & attributes kept

XML Input

Indent

JSON Output

Your JSON will appear here the moment you paste XML...

Need the other direction?

Turn JSON back into well-formed XML with the same CDATA-safe engine.

JSON to XML Converter

Quick answer: how do I convert XML to JSON?

Paste your XML above or upload an .xml file. This free XML to JSON converter validates the document, maps attributes to @name keys, keeps element text under #text, preserves CDATA under #cdata and turns repeated elements into arrays. Copy or download the JSON — everything runs in your browser, with no signup and no upload.

How XML maps to JSON

Predictable, reversible rules — the same ones our JSON to XML converter reads back.

XMLJSONWhy
<item id="1"/>{ "item": { "@id": "1" } }Attributes keep an @ prefix so they never clash with elements
<p class="a">Hi</p>{ "@class": "a", "#text": "Hi" }Mixed content keeps text under #text
<d><![CDATA[<b>x</b>]]></d>{ "d": { "#cdata": "<b>x</b>" } }CDATA is copied verbatim, never escaped or re-indented
two <item> siblings{ "item": [ ... ] }Repeated names become arrays automatically

Convert XML to JSON in 3 Steps

1

Paste or upload your XML

RSS and Atom feeds, SOAP envelopes, sitemaps, SVG, pom.xml — anything well-formed works.

2

Pick your options

Keep attributes, preserve CDATA, and optionally detect numbers and booleans instead of strings.

3

Copy or download JSON

Take the JSON straight into your API, test fixture or database import.

Related Tools You Might Need

Discover other powerful data processing tools from our comprehensive suite, ordered by popularity and usage among our users.

CSV to Excel Converter

Convert CSV files to Excel format instantly with our fast, free online tool.

Most Popular

Remove Duplicates

Remove duplicate rows from your CSV data quickly and efficiently.

Most Popular

JSON Beautifier

Format and beautify JSON data with proper indentation and syntax highlighting.

Most Popular

CSV to JSON Converter

Transform CSV data into JSON format with customizable options.

Available

JSON to CSV Converter

Convert JSON data to CSV format for spreadsheet applications.

Available

Merge CSV Files

Combine multiple CSV files into one with smart column matching.

Available

SQL Query CSV

Query CSV data using SQL syntax directly in your browser.

Available

Email Extractor

Extract email addresses from text, CSV files, or any data format.

Available

XML to JSON FAQs

Paste your XML into the input box or upload an .xml file. The converter parses the document in your browser and instantly returns formatted JSON that you can copy or download. There is no signup, no file-size account limit and nothing is uploaded to a server.

Yes. CDATA blocks are captured verbatim and returned under a "#cdata" key, so embedded HTML, scripts or markup inside an RSS description survive the conversion character for character. You can also switch CDATA handling off to merge it into plain text.

Attributes are prefixed with "@" — so <item id="101"> becomes { "@id": "101" }. Element text that sits alongside attributes or child elements is stored under "#text". This is the widely used "badgerfish-style" convention that most parsers understand.

Repeated sibling elements with the same name are automatically collected into a JSON array. A channel with five <item> elements becomes an "item" array with five objects, which is exactly what you need for feeds and API payloads.

Yes. RSS, Atom, sitemaps, SOAP envelopes, SVG, pom.xml, Android layouts and Office XML parts all convert cleanly, including feeds whose descriptions hold HTML inside CDATA.

Only if you turn on "Smart types". By default every value stays a string, which is the safest option for IDs, postal codes and version numbers that must not lose leading zeros. Smart types converts "12", "true" and "null" to real JSON types.

Completely. Parsing and conversion run in local JavaScript inside your browser tab. Your XML is never transmitted, logged or stored, which makes the tool safe for invoices, health data, SOAP payloads and internal configuration files.

The document is validated with the browser XML parser before conversion. If a tag is unclosed or mismatched, you get the exact parser message describing the problem instead of silently wrong JSON.

Yes. Our JSON to XML converter uses the same engine and the same "@attribute" / "#text" / "#cdata" conventions, so a round trip returns an equivalent document.

There is no hard limit. Because everything runs locally, the practical ceiling is your device memory — documents of several megabytes convert comfortably in a modern browser.

Convert XML to JSON online with attributes, CDATA and text preserved. Paste or upload XML, choose output options and copy or download the JSON.

Tool
XML to JSON Converter
Category
All JSON tools
Availability
Browser-based tool