Convert JSON to XML With Attributes (@-Prefix Convention)
Going the other direction — JSON to XML — is where most naive converters fall down: without a convention for attributes, everything just becomes a child element. This converter recognizes one specific shape.
The real behavior
To produce an attribute, not a child element: the JSON key must start with @ — "@lang": "en" on a node becomes lang="en" on that node's XML tag. A #text key becomes the element's text content alongside its attributes. Any other key, including ones that merely look attribute-like, is emitted as a nested child element instead. The converter also refuses non-object input outright — an empty object or a bare array at the root throws "JSON object is empty" rather than silently producing empty XML.
XML ↔ JSON Converter
Convert between XML and JSON with attribute handling, nested elements, and CDATA support.
XML ↔ JSON Converter: Convert between XML and JSON with attribute handling, nested elements, and CDATA support. Runs entirely in your browser — paste your input, get instant output, nothing is uploaded.
🔒 This tool runs entirely in your browser. No data is sent to any server.