Skip to main content

JSON to XML Converter

Runs locally

Convert JSON documents to properly escaped XML with custom root and attributes.

What is JSON to XML Converter?

Transform JSON objects and arrays into valid, properly escaped XML using fast-xml-parser. Customize the root element name, attribute prefix, XML declaration, and indentation.

How to use JSON to XML Converter

  1. Step 1

    Paste JSON into the input panel.

  2. Step 2

    Set root tag name, indentation, and attribute prefix if needed.

  3. Step 3

    Copy or download the resulting .xml file.

Features

  • Properly escapes &, <, >, and quotes in XML values
  • Supports attribute prefix mapping (e.g. @_id)
  • Optional <?xml version="1.0"?> declaration
  • Customizable root element wrapper for arrays
  • Pretty-print or compact single-line XML output
  • Runs completely in your browser

Example

Input

{"user":{"@_id":"42","name":"Ada & Grace"}}

Output

<?xml version="1.0" encoding="UTF-8"?>
<user id="42">
  <name>Ada &amp; Grace</name>
</user>

Escapes special XML characters and maps @_ attributes cleanly.

Frequently asked questions

How are XML attributes represented in JSON?

Keys starting with @_ (configurable) are emitted as XML attributes.

Does it escape special characters like & and < ?

Yes, fast-xml-parser encodes XML entities automatically so output is well-formed.

Is data sent to a backend?

No, everything runs locally in your browser.

Can I convert the XML back to JSON?

Yes, click Swap or open the output in XML to JSON.