Skip to content

Free XML to JSON Converter

Convert, parse or transform XML to JSON online — instantly. Handles attributes, nested elements and namespaces, entirely in your browser. Free, with no sign-up required — everything happens right in your browser, so nothing you enter is sent to a server.

🔄 XML to JSON Converter

How the XML to JSON Converter Works

Paste XML and press Convert. The tool uses your browser's DOM parser to read the document, which means malformed XML is reported as an error instead of being guessed at. It then walks the element tree: each element becomes a JSON key, nested elements become nested objects, repeated sibling elements with the same name become an array, and text content becomes a string value.

Switch on Include attributes to keep XML attributes, which are stored under an @attributes key on their element. XML and JSON are not identical, so choices have to be made: a single child becomes an object while several identical children become an array, so the shape of the result can change with the data. Check your converted output if you feed it into code that expects a fixed structure.

Practical Use Cases

  • Convert data from an XML API, RSS feed or sitemap so it is easier to work with in JavaScript.
  • Inspect the structure of an XML file in a more readable form.
  • Move configuration or data between systems that use XML and JSON.
  • Check that an XML document is well formed by seeing whether it parses.

Tips for Best Results

  • Turn on Include attributes when your XML stores data in attributes. Otherwise only the element text is converted.
  • Expect single elements to become objects and repeated ones to become arrays, and write your code to handle both shapes safely.
  • Escape ampersands as & and close every tag before converting. Strict XML parsing rejects documents that a browser might tolerate in HTML.

Frequently Asked Questions

Yes. Turn on Include attributes and they are stored under an @attributes key in the JSON output.
Yes. Nested elements are converted recursively into nested objects, and repeated elements become arrays.
Yes. Paste your XML and it is converted in your browser. There is nothing to install and your file is not uploaded.
A single element becomes an object, and repeated elements with the same name become an array. If your code expects a list, wrap single objects in an array when you read the data.
The parser reports an error and no JSON is produced. Fix problems such as unclosed tags or unescaped ampersands and try again.