JSON Toolkit

Fast, private JSON tools that run in your browser.

🔒 Data stays in your browser

XML to JSON Converter

Paste XML or open a file to convert it to JSON. Attributes become @name keys, repeated elements become arrays, and CDATA and namespaces are preserved. Invalid XML is reported with the exact line and column.

JSON ⇄ XML Converter

Keys starting with @ are attributes and #text is an element's text, e.g. { "price": { "@currency": "EUR", "#text": 9.99 } } ⇄ <price currency="EUR">9.99</price>. Lists become repeated elements.

How to use the XML to JSON Converter

  1. Paste your XML, or click Open file… to load an .xml file.
  2. Choose whether to include attributes and convert numbers and booleans.
  3. Click Convert to JSON, then copy, download, or open the result in the formatter.

Features

  • Attributes as @name keys and text next to attributes as #text
  • Repeated elements become arrays
  • CDATA sections and namespace prefixes are kept
  • Exact line and column for errors, including mismatched tags
  • Blocks XXE, billion laughs and prototype pollution attacks

Frequently asked questions

Why is one element an object, but two become an array?
XML has no way to say that an element is meant to be a list, so a single <item> becomes an object and repeated <item> elements become an array.
Is it safe to convert XML I don't trust?
Yes. External entities are refused, entity expansion attacks are not expanded, and names such as __proto__ are blocked. Nothing outside the pasted text is ever read.
What happens to mixed text, like HTML?
Text that sits between child elements is collected into #text and its position is lost. The converter warns you when this happens.

Related tools