JSON to XML Converter

Convert JSON to XML and XML back to JSON. Values are properly escaped, arrays are handled correctly, and invalid element names are sanitised — so the output is always well-formed XML.

XML requires a single root element; JSON has no equivalent.

XML output
JSON output

How the two formats map to each other

JSON and XML do not line up perfectly, so a few rules decide the conversion:

Worked example. This JSON:

{ "note": "a & b < c", "tags": ["x", "y"] }

becomes this XML:

<root>
  <note>a &amp; b &lt; c</note>
  <tags>x</tags>
  <tags>y</tags>
</root>

Common pitfalls this tool avoids

PitfallBroken outputCorrect output
Unescaped & <note>a & b</note> <note>a &amp; b</note>
Array of plain values <tags><0>x</0></tags> <tags>x</tags>
Key starts with a digit <2fa>true</2fa> <_2fa>true</_2fa>
Null value <note></note> <note nil="true"/>

Frequently asked questions

Are special characters escaped in the XML output?
Yes. Ampersand, less-than, greater-than, quotes and apostrophes are converted to XML entities, so values such as "a & b < c" produce well-formed XML.
How are JSON arrays represented in XML?
Each array item is emitted as a repeated element using the property name. An array of objects nests inside each repeated element, while an array of plain values becomes one element per value.
What happens to invalid XML element names?
XML element names must start with a letter or underscore and cannot contain spaces. Names that break these rules, such as keys starting with a digit, are sanitised automatically.
Is my data uploaded anywhere?
No. Both conversions run entirely in your browser. Nothing you paste is sent to a server.

Related tools

Last updated: August 31, 2026