All free tools Runs in your browser

JSON to XML Converter

Turn JSON into well-formed XML for legacy systems, SOAP services, feeds and config files.

Convert JSON to XML

.json
Any valid JSON: an object, an array or a single value. Press Ctrl + Enter to convert again.
Read locally with FileReader and never uploaded. Maximum 15 MB.
Conversion options

Your JSON never leaves this device. The conversion is done by JavaScript in your browser. Nothing is uploaded to VPSLake or stored.

Convert JSON in four steps

Handy when a modern API has to feed a system that only speaks XML.

  1. 1

    Paste or open the JSON

    Paste the data or open a file. If it is not valid JSON, the error shows the line and column to fix.

  2. 2

    Set the root and attributes

    Name the root element, and choose the prefix that marks a key as an attribute, such as @id.

  3. 3

    Convert

    Press Convert to XML. Special characters are escaped and invalid tag names are repaired automatically.

  4. 4

    Check and use the XML

    Copy it or download converted.xml, then confirm it on your server with xmllint --noout converted.xml.

How JSON is mapped

Each object key becomes an element and each value becomes its content. An array repeats its parent element once per item, which is how XML normally represents lists.

  • Keys starting with the prefix become attributes
  • A #text key becomes the element's text
  • null and empty arrays become empty tags
  • &, <, > and quotes are escaped

Keys that are not valid tag names

XML element names cannot start with a digit, contain spaces or begin with xml. JSON keys can. The converter replaces illegal characters with _ and adds a leading _ where needed, so "2fa code" becomes <_2fa_code>.

If the receiving system expects exact tag names, rename those keys in the JSON first.

JSON to XML Converter FAQ

No. Everything runs in your browser. The JSON and the XML you get back are never sent to VPSLake or stored.
Start the key with the attribute prefix, which is @ by default. {"server": {"@id": 7, "name": "web"}} becomes <server id="7"><name>web</name></server>. Only plain values can be attributes; objects and arrays always become elements.
XML needs exactly one root element, so the array is placed inside the root element you name, with each entry written as an <item> element.
It was not a legal XML name. Spaces and symbols become underscores, and names that start with a digit or with "xml" get a leading underscore.
Not usually. It is recommended for files and for UTF-8 text with non-English characters. Untick the option if the XML will be embedded inside another document.
Nothing is converted. You get the line and column where parsing failed, the reason, and the offending line with a pointer, so you can fix it and press Convert again.