JSON to XML

JSON to XML

Convert JSON to XML. Keys starting with @ become attributes (for example "@id"). Use a root element name of your choice.

The JSON to XML Converter translates modern JSON data into XML for systems that still speak XML, such as older enterprise services, document feeds, and some configuration formats. The two formats describe the same tree of information in different clothing, so a careful, predictable conversion matters more than a clever one.

This converter follows simple documented rules. Each JSON key becomes an element with the same name. Arrays become repeated elements, one per item. Keys that start with the @ symbol become attributes instead of child elements, so "@id": "1" turns into id="1" on the parent element. You choose the root element name, and a standard XML declaration is added at the top.

Special characters in values are escaped correctly, and empty objects become self-closing tags. The whole conversion runs in your browser; nothing is uploaded to a server, so private data stays private while you work.

How to use

  1. Type a root element name, or keep the default "root".
  2. Paste your JSON into the box.
  3. Click Convert to XML.
  4. Review the result, then copy it or download it as an .xml file.
  5. To create attributes, rename the JSON keys with an @ prefix before converting.

Frequently asked questions

How are arrays converted?

Each item in an array becomes its own element with the array's key name, repeated in order. For example, "tags": ["a","b"] becomes two <tags> elements.

What if a key is not a valid XML name?

XML names cannot start with a number or contain spaces. Rename such keys in your JSON first; the converter keeps names as they are so the output stays predictable.

Can I convert the XML back to JSON?

Yes, with the XML to JSON tool on this site. Note that round trips can differ slightly, because XML attributes and repeated elements have no single universal JSON shape.

Is my data sent anywhere?

No. The conversion is plain JavaScript in your browser. Nothing is uploaded, saved, or shared.