XML to JSON Converter

Convert XML to JSON free in your browser — paste XML or upload an .xml file and get clean, formatted JSON in one click. Attributes become @-prefixed keys, repeated elements become arrays, and nothing you paste ever leaves your device, because the conversion runs entirely on your computer.

XML to JSON Converter

Paste XML or upload an .xml file and get clean, formatted JSON in one click. Free, private, no signup.

Paste XML and press Convert to JSON.

100% private — parsing uses your browser’s built-in DOMParser. Nothing you paste or upload is sent to a server, so SOAP responses, RSS feeds and config files with credentials stay on your device.

How to use the XML to JSON Converter

  1. Paste your XML or upload an .xml file.
  2. Choose the JSON indent (or Minified).
  3. Click Convert to JSON.
  4. Copy the result or download it as a .json file.

How XML maps to JSON: attributes, repeated elements and text

XML and JSON describe the same kind of data — nested values with names — but they use different rules, so a converter has to pick one consistent mapping, and this tool uses the mapping most developers expect. Every element name becomes a JSON key, and the element’s content becomes the value. An element that holds only text, such as <title>Midnight Rain</title>, becomes a plain string: “title”: “Midnight Rain”. Attributes are different from child elements, so they are kept separate by prefixing the attribute name with @. The element <book id=”bk101″ lang=”en”> therefore produces “@id”: “bk101” and “@lang”: “en” next to its child keys, which means no information is lost and you can always tell an attribute apart from a child element. When an element has both attributes and text, the text is stored under a “#text” key, so <price currency=”USD”>44.95</price> becomes “price”: {“@currency”: “USD”, “#text”: 44.95}. Repeated sibling elements are the other important rule: a single <book> stays a single object, but two or more <book> elements under the same parent collapse into a JSON array in document order, which is exactly how most APIs expect lists to look. CDATA sections are treated as ordinary text, so content wrapped in <![CDATA[…]]> comes through unchanged. Two things do not survive the trip, because JSON has no equivalent for them: XML comments and processing instructions are dropped. The result is clean, predictable JSON that works with JSON.parse, jq and every JSON tool.

Convert XML files, SOAP responses and RSS feeds to JSON

XML still shows up in places JSON never reached, and this converter handles the formats you are most likely to meet. SOAP web services return XML envelopes full of namespaced elements and attributes, and converting the response to JSON makes it far easier to inspect in a browser console or feed into a JavaScript app. RSS and Atom feeds are XML documents too: paste a feed and you get a JSON object with the channel, items and links as keys you can read at a glance instead of hunting through angle brackets. Configuration files are another common case — many older applications, build tools and content management systems still store settings in XML, and turning those settings into JSON lets you compare, edit and validate them with modern JSON tooling. Sitemaps are XML lists of URLs with last-modified dates and priorities, and a JSON version is much easier to filter, sort or load into a spreadsheet workflow. Developers also use the converter when an API offers only an XML endpoint, when a legacy system exports XML reports, or when test fixtures need to be rewritten as JSON for a test suite. Because the converter runs entirely in your browser, even files that contain internal hostnames, API keys or credentials stay on your machine, and you can paste a fragment or a whole document — the only practical limit is how much text your browser can hold.

Why convert XML to JSON in your browser

Most online XML to JSON converters send your file to a server, convert it there and send the result back. That is fine for a public RSS feed, but it is a poor choice for a SOAP response that contains session tokens, a config file with database credentials, or an export with customer data. This converter never uploads anything: the parsing is done by your browser’s built-in DOMParser, so your XML never leaves your device, there is no account to create, no email to hand over and no usage counter ticking up in the background. It also works offline once the page has loaded, and there is no file-size cap beyond what your browser can comfortably hold in memory. If the JSON you get back still needs tidying, run it through our JSON Formatter to re-indent it or check it is valid. The trade-off is an honest one. Because JSON has no equivalent for XML comments or processing instructions, those are dropped during conversion, so a heavily commented config file will lose its comments. The mapping also has one quirk worth knowing: a tag that appears once becomes a single object or string, while the same tag appearing twice becomes an array, so code that consumes the output should be ready for either shape. Within those limits, the tool is free, unlimited and private — paste, convert, copy and move on.

Try more free Web Tools: JSON Formatter and Base64 Encoder.

Frequently asked questions

Is this XML to JSON converter free?

Yes, completely free with no signup, no usage limits and no watermarks.

How are XML attributes converted to JSON?

Every attribute becomes a key prefixed with @, so id=”bk101″ becomes “@id”: “bk101”, keeping attributes distinct from child elements.

What happens to repeated XML elements?

Sibling elements with the same tag name collapse into a JSON array in document order, so two <book> elements become “book”: […] with two items; a tag that appears once stays a single object or string.

Is my XML uploaded to a server?

No. The conversion uses your browser’s built-in DOMParser, so your XML never leaves your device — safe for SOAP responses, RSS feeds and config files that may contain credentials.