Developer Tools

XML to JSON Converter

Parse XML documents, feeds and API responses into readable JSON.

Read XML data the easy way

RSS feeds, sitemaps, SOAP services, office documents and many government and banking systems use XML. Working with XML in JavaScript or Python is more awkward than working with JSON, and deeply nested tags are hard to read. This converter turns any well-formed XML into a JSON structure you can explore, use in code or feed into other tools.

How to convert XML to JSON

  1. Paste your XML. The declaration line <?xml …?> is optional.
  2. Keep Convert numbers and true/false ticked to get real numbers and booleans instead of text.
  3. Tick Always use arrays if your code expects lists even when an element appears only once.
  4. Click Convert to JSON. If the XML is broken, the parser's error message is shown.

Mapping rules

Why does one book become an object but two become an array?

XML has no way to say "this is a list". The converter only knows an element repeats when it sees it twice. That means the same feed can produce an object one day and an array the next. If you are writing code that reads the JSON, tick Always use arrays so every child element is consistently an array.

Frequently asked questions

What does "Invalid XML" usually mean?

A tag is not closed, tags are closed in the wrong order, there is a bare & that should be &amp;, or there is more than one root element.

Are namespaces supported?

Yes. Prefixed names such as dc:title are kept as they are in the keys.

Can I go back from JSON to XML?

Yes, with the JSON to XML converter, which uses the same @ and #text rules.