JSON formatter and validator
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 charsOutput
0 lines | 0 charsExample
{ "book": { "title": "JSON", "tags": ["api", "data"] } }<?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.
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.
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.
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.
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 (&, <, 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.