Skip to main content
File & Data Conversion Tools

JSON to XML Converter

Convert JSON to well-formed XML - objects become nested elements, arrays become repeated elements, with proper escaping.

Paste JSON below - this tool converts objects to nested XML elements and arrays to repeated elements, escaping all text content properly.

JSON keys that aren't valid XML element names (starting with a digit, containing spaces) are flagged - this tool won't silently generate broken XML.

How the Conversion Works

A JSON object's keys become XML element names wrapping their values; a JSON array's items become repeated sibling elements sharing the array's key as their element name; primitive values become the element's text content, properly escaped.

How to Use It

  1. Paste valid JSON.
  2. Optionally set a root element name.
  3. Click Convert.
  4. Copy or download the resulting XML.

Limitations

JSON has no native concept of XML attributes - this converter represents all JSON data as nested elements rather than guessing which fields you'd want as attributes, keeping the mapping predictable.

Example

{ "book": { "title": "Dune", "year": 1965, "tags": ["sci-fi", "classic"] } }

becomes:

<?xml version="1.0" encoding="UTF-8"?>
<root>
  <book>
    <title>Dune</title>
    <year>1965</year>
    <tags>sci-fi</tags>
    <tags>classic</tags>
  </book>
</root>

The array becomes repeated <tags> elements, which is how XML represents lists.

When You Need XML

  • Sending data to a SOAP service or an older enterprise API.
  • Building sitemaps, RSS feeds or product feeds from JSON data.
  • Feeding data into XSLT transformations or tools that validate against an XSD schema.

Tips

  • Rename keys that start with a digit or contain spaces before converting - XML element names cannot.
  • Choose a meaningful root element name; XML documents must have exactly one root.
  • If a system expects some fields as attributes (<book id="7">), adjust those by hand after converting.

Convert back with XML to JSON. Check your JSON first with the JSON Validator.

Frequently Asked Questions

XML has no array type, so each item becomes a repeated element with the same name.

A well-formed XML document must have exactly one top-level element, so the data is wrapped in a root element - you can choose its name.

XML element names cannot start with a number or contain spaces. Such keys are kept as-is and the tool shows a warning, so rename them in your JSON first for valid XML.
Share this tool: