Runs in your browser

XML to JSON Converter Online

Paste XML and get clean JSON. Attributes, namespaces and comments are kept, and the JSON converts back to the same XML.

XML input

Paste XML here, open a file or drop it here…

JSON output

The result appears here.
How XML and JSON are mapped

Both converters use the same reversible mapping, so XML → JSON → XML gives the same document. Whitespace between elements is ignored; all other text stays exactly as it is. Numbers and booleans stay strings, so values like 0001 are not changed.

XMLJSON
Root element <ORDERS05>{ "ORDERS05": … } – the name is kept
Element with text only"text" (string, unchanged)
Empty element""
Attribute id="1""@id": "1"
Namespace declaration"@xmlns:ns0": "urn:…"; prefixes stay in names ("ns0:Order")
Text next to attributes or children"#text": "…"
CDATA section"#cdata": "…"
Comment"#comment": "…"
Processing instruction <?target data?>"?target": "data"
Mixed content (text and elements)"#mixed": ["text", { "b": "bold" }, " more"]
Repeated elementArray – consistently for that path in the whole document