XML to JSON Converter

XML to JSON Converter parses XML and turns it into readable JSON. Attributes become @-prefixed keys, text content lands under #text, and repeated tags collapse into arrays — a predictable mapping that round-trips with the JSON to XML tool.

Paste your XML and the JSON appears instantly, syntax-highlighted and ready to copy. It all runs locally in your browser.

XML input
JSON output
JSON appears here.

How to use XML to JSON Converter

  1. 1

    Paste your XML

    Drop a well-formed XML document into the input box.

  2. 2

    Get the JSON

    The structured JSON appears live, with highlighting.

  3. 3

    Copy the result

    Use the copy button to grab the JSON output.

How XML maps to JSON

Every element becomes a key. Its attributes appear as keys prefixed with @, and any text content appears under the #text key when the element also has attributes or children. When a tag repeats inside its parent, those occurrences collapse into a JSON array so order is preserved.

Elements with only text and no attributes simplify to a plain string value, keeping the output compact.

What is supported

The converter handles elements, attributes, nested structures, repeated tags, self-closing tags and CDATA sections, and it decodes standard entities like & and <. Comments, processing instructions and the XML declaration are skipped.

Namespaces are preserved verbatim as part of the tag name, so a prefixed tag keeps its prefix in the JSON key.

Frequently asked questions

How are attributes handled?
Attributes become keys prefixed with @, and element text content is placed under the #text key.
What happens to repeated tags?
Repeated child tags collapse into an array, preserving their order.
Is my XML uploaded anywhere?
No. Parsing and conversion happen entirely in your browser.

Last updated: