Back to All Tools

XML ↔ JSON Converter

Bidirectionally convert between XML and JSON. Attribute names are preserved with an @_ prefix in the JSON representation.

Attribute convention

XML attributes are mapped to JSON keys prefixed with @_. For example, <book id="1"> becomes {"book": {"@_id": "1"}}. When converting back from JSON to XML, any key beginning with @_ is written as an XML attribute.

Tips

  • Wrap the root JSON object in a single top-level key — this becomes the root XML element name.
  • Repeated sibling elements become JSON arrays automatically.
  • Text content of an element is stored under the #text key when attributes are also present.