Paste or open JSON and get well-formed XML with the root element, item names and attributes you choose. The conversion runs in your browser.
How it works
Open or paste JSON
Paste JSON, open a .json file, load one from a URL or try the sample.
Set the XML options
Choose the root element, the element name for array items, the attribute prefix, indentation, the XML declaration and how null is written.
Download or copy
Download the .xml file, copy it, open it in the XML Viewer, or convert it back with XML → JSON.
Features
Root element and arrays
An object with a single key becomes the root element; otherwise the data is wrapped in your root element. Arrays repeat their element, and items of nameless arrays use the item element name.
Attributes and text
Keys starting with @ become attributes and #text becomes the element text, so {"book": {"@id": "1", "#text": "A"}} gives <book id="1">A</book>.
Valid names, always
Keys that are not valid XML names, such as 1a or first name, are changed to _1a and first_name, and the changes are listed.
Well-formed result
Special characters are escaped, characters not allowed in XML are replaced, and the output is checked with an XML parser before you get it.
Formatting
Indent with 2 or 4 spaces or tabs, or write everything on one line. null becomes an empty element or xsi:nil="true".
Limits & privacy
JSON files can be up to 100 MB. Files above 5 MB are converted from the file without loading them into the editor, which shows only the beginning.
XML schemas, namespaces and SOAP envelopes are not generated. Numbers that do not fit a JavaScript number are written exactly as in the source. See the privacy page.
FAQ
How do I convert JSON to XML?
Paste the JSON or open the file. The XML appears as you type; press Download .XML to save it or Copy to use it elsewhere.
How do I set the root element name?
Type it in Root element. If your JSON is an object with one key, such as {"catalog": {…}}, that key becomes the root automatically.
How do I create XML attributes from JSON?
Prefix the key with @, for example "@id": "42". You can change the prefix in Attribute key prefix.
What happens to JSON arrays?
Each item becomes a repeated element with the array's key as its name. Top-level and nested arrays use the array item element name, item by default.
Can I use it as a JSON to XML formatter?
Yes. The output is indented with 2 spaces by default, and you can choose 4 spaces, tabs or a single line.
Is this JSON to XML converter online free and private?
Yes. It is free, and the conversion happens in your browser, so your data never leaves your device.