XML to JSON

Convert XML documents to JSON.

No upload

Loading tool…

Processing happens on your device using your browser's CPU/GPU. Results are kept only in this tab's memory and are wiped when you click “Clear” or close the page.

About XML to JSON

Paste an XML document and get equivalent JSON you can actually work with in JavaScript or Python. Element names become keys, attributes are prefixed with @, repeated tags become arrays, and mixed text is kept under #text. This is the quick way to inspect an SOAP reply, an RSS feed or a GST or bank XML file before you write parsing code. It converts locally in your browser.

How to use XML to JSON

  1. Paste your XML into the left pane or open an .xml file from your device.
  2. The JSON appears on the right as you type, using the browser's own XML parser.
  3. Check the attribute keys, which start with @, and any #text values for mixed content.
  4. Copy the JSON or download it as data.json.

What people use it for

  • Reading a SOAP or legacy bank API response without writing a parser first
  • Converting an RSS or sitemap feed into JSON for a small script
  • Inspecting an XML export from Tally or a government portal before importing it
  • Teaching or learning how XML structure maps onto JSON objects and arrays

Good to know

Attributes appear as @name keys and text content as #text when an element also has attributes or children. A tag repeated inside its parent becomes a JSON array automatically, so a single-item list may look like an object while a two-item list becomes an array. Invalid XML is reported with the parser's first error message rather than guessed at.

Frequently asked questions

Why do some keys start with @ or #?
The @ prefix marks an XML attribute and #text holds an element's own text when it also has attributes or child elements. This keeps both kinds of content in one JSON object.
Are namespaces preserved?
Yes, prefixed names such as soap:Body are kept exactly as they appear in the document, so you may need to quote those keys in your code.
Will it fix broken XML?
No. The browser's strict XML parser reports the first error and stops. Unclosed tags, stray ampersands and missing quotes around attribute values must be corrected in the source.
Does the XML leave my computer?
No. The conversion uses the DOMParser built into your browser, so the document stays on your device and is discarded when the tab closes.