JSON to XML converter

Convert JSON into well-formed, indented XML for legacy APIs, SOAP services, and document pipelines — entirely in your browser.

Input JSON

0 lines | 0 chars
Paste JSON, then validate or transform it.

Output

0 lines | 0 chars

Example

Input JSON
{ "book": { "title": "JSON", "tags": ["api", "data"] } }
XML output
<?xml version="1.0" encoding="UTF-8"?>
<root>
  <book>
    <title>JSON</title>
    <tags>
      <item>api</item>
      <item>data</item>
    </tags>
  </book>
</root>

How to convert JSON to XML

Generate well-formed XML from any JSON value.

  1. Paste or load your JSON

    Paste JSON into the Input panel, upload a .json file, or fetch it from a URL. Objects, arrays, and primitive values are all converted.

  2. Convert to XML

    XML is already selected in the Convert dropdown on this page. Click Convert to produce a well-formed document that starts with an XML declaration and wraps your data in a <root> element.

  3. Set the indentation

    Use the Pretty indent control to choose how many spaces each level is indented (1–8), so the output matches your house style.

  4. Copy or download the XML

    Copy the XML to your clipboard or download it for use in a SOAP request, an RSS feed, an Android layout, or any XML-consuming system.

JSON to XML — questions

How JSON structures map onto XML elements.

How are arrays converted to XML?

Each element of an array becomes a repeated <item> element inside its parent, because XML has no native array type. This keeps the document well-formed while preserving order.

How are object keys turned into tag names?

Each key becomes an element name. Characters that aren't valid in an XML tag are replaced with underscores, and a name that would start with a digit is prefixed so the document stays valid.

Are special characters escaped?

Yes. The reserved characters &, <, >, ", and ' are escaped to their entity equivalents (&amp;, &lt;, and so on) so the output is always well-formed XML.

What does the top of the document look like?

The output begins with the declaration <?xml version="1.0" encoding="UTF-8"?> followed by a single <root> element that contains your converted data — exactly one root element, as the XML spec requires.

Is my data sent anywhere?

No. The JSON-to-XML conversion runs completely in your browser, so nothing you convert is uploaded or logged.