XML ↔ JSON Converter

Convert XML documents to JSON objects and JSON back to XML. Uses the browser's native XML parser.

Direction
JSON Output

How to use the XML ↔ JSON Converter

  1. Select the direction: XML → JSON or JSON → XML.
  2. Paste your XML or JSON into the input box.
  3. Click Convert. XML attributes are preserved with an @ prefix in the JSON output.
  4. Copy the result to your clipboard.

How XML attributes are handled

XML attributes (e.g. <user id="1">) are mapped to JSON keys prefixed with @ (e.g. {"@id": "1"}). Text content of an element is stored under the #text key when the element also has attributes or child elements.

Limitations

XML supports features that have no direct JSON equivalent, such as processing instructions, DTDs, and mixed content. This tool focuses on the most common use case: converting data-oriented XML documents to JSON objects and back.