Free JSON to XML Converter

Paste JSON, upload a .json file or load a public URL, then convert it to well-formed XML you can copy or save. Free, no account needed.

Upload File

Result

Free JSON to XML Converter: What It Does

Quick answer: To convert JSON to XML, paste your JSON, upload a .json file or load a public address, press Json to XML, then copy the XML or save it. Every key becomes an element, renamed first if the name is not valid XML.

Developers and data analysts use it to move key value pairs from a REST API into legacy systems, SOAP or a config file that reads only XML elements. Keys become elements, arrays repeat the key, and everything sits inside a <root> element. There are no attributes, so edit the output by hand if your target needs them.

How to Convert JSON to XML Online

No sign-up, and nothing to install.

  1. Add your JSON. Type or paste it into Enter or paste JSON, use the upload button to upload a .json file, or put a public address in Load from URL. A parse error shows before anything converts.
  2. Press Json to XML. A Result card opens with the XML output and an info line if any key names changed.
  3. Check the result. Watch for renamed keys, which the info line counts, and empty tags where you expected values.
  4. Copy or save. Copy to Clipboard grabs the XML tags, while Save as TXT downloads json-to-xml.txt, so rename it to .xml.

JSON to XML Example: Objects, Arrays, null and Booleans

These outputs come straight from the tool, starting with a nested object.

{"name":"Ada","address":{"city":"Paris","zip":"75001"}}
<?xml version="1.0" encoding="UTF-8"?>
<root>
	<name>Ada</name>
	<address>
		<city>Paris</city>
		<zip>75001</zip>
	</address>
</root>

A json array to xml conversion reuses the key name for every member, with no wrapper. So {"users":[{"id":1},{"id":2}],"tags":["a","b"]} gives two <users> elements and two <tags> elements side by side.

Now the awkward values. {"a":null,"b":true,"c":false,"d":"","e":{},"f":[]} gives <a/>, <b>true</b>, <c>false</c>, <d/>, <e/> and <f/>. Four different JSON values land on one empty tag. If you want a sitemap, the XML sitemap generator crawls a site and writes one.

How the Converter Maps JSON Into XML

JSON featureXML resultNote
ObjectNested elementsSource order kept
ArrayRepeated elementsKey name reused
Top-level array<item> childrenUnder <root>
Array in an arrayRepeated elements with <item> children[[1,2],[3]] gives two elements
StringEscaped textQuotes are not escaped, only & < > and carriage returns
NumberCopied exactly12345678901234567890123 stays
true, falseThe wordsPlain text
null, "", {}, []One empty tagIndistinguishable
Duplicate keyBoth keptJSON.parse keeps the last
Top-level "hello"Text in <root>No child element is created

The XML declaration, the <root> name and the tab indentation are fixed.

Key Names and Special Characters in XML

XML element names have rules and JSON keys do not, so we rename the ones that would break well-formed XML. First name becomes first_name, a:b becomes a_b, 1st becomes _1st and an empty key becomes _. Accented letters such as é stay, and @id becomes _id, not an attribute. The info line counts renamed names.

Escaping: & becomes &amp;, < becomes &lt;, > becomes &gt; and a carriage return becomes &#13;. The XML declares UTF-8, so Unicode letters and emoji pass through. Characters XML 1.0 forbids become the U+FFFD replacement character, counted in the info line. The exact name rules live in the Extensible Markup Language (XML) 1.0 specification. Next, how to format XML online covers tidying the output.

What This Converter Cannot Do

The output is deliberately plain: no attributes, no namespaces, and no say over the root name, indentation or item name.

The conversion cannot be reversed exactly, because empty values look alike and a one-item array looks like a plain value. Keep the source JSON. The XML vs JSON guide explains why the formats differ.

Numbers are copied as typed, so 12345678901234567890123 comes through intact. Pasted and uploaded text has no size cap, but your browser does the work. In our test, 0.4 MB took 4.3 seconds and 2.1 MB took 8.8 seconds. Load from URL stops at about 3 MB, and nesting deeper than 2,000 levels is refused.

Is Your JSON Sent to a Server?

Pasted JSON and uploaded files are converted in your browser, and the page never posts its form. A last check re-parses the XML with DOMParser for well-formedness. Load from URL is the exception: our server fetches the file and refuses local addresses such as 127.0.0.1.

Why You Get a JSON Error

Invalid JSON stops with a parser message that points at the problem. Strict JSON rejects a trailing comma, single quotes, unquoted keys and leading zeros such as 007. An empty editor says Paste or type some JSON first.

Run a stubborn file through the JSON Validator. RFC 8259 defines valid JSON, including UTF-8 text.

Related Free JSON and XML Tools

Choose the tool that matches your next step.

Last updated

Frequently Asked Questions

Frequently Asked Questions (FAQs) is a list of common questions and answers provided to quickly address common concerns or inquiries.

How do I convert JSON to XML online?

Press Json to XML after pasting, uploading or loading your JSON. A syntax error is reported first, so you never get half an answer. Copy the result or save it. It costs nothing and needs no account.

How are arrays converted to XML?

Each array member becomes a sibling element that reuses the key name, with no wrapper. A tags array holding a, b and c gives three tags elements. A top-level array becomes item elements under the root element, and an array of objects gives one element per object.

What happens to null and empty values?

Null, an empty string, an empty object and an empty array all become the same empty tag, so XML cannot tell them apart. True and false are written as the words. An empty array nested inside another array collapses the same way.

Can JSON keys become XML attributes?

No. Every key becomes an element, because JSON has no attributes. A key that starts with @ is renamed to start with an underscore, so @id turns into _id. If your target system needs attributes, edit the XML afterwards in a text editor.

Is my JSON uploaded to a server?

Pasted JSON and uploaded .json files are converted in your browser, and the page never posts its form. Load from URL is the exception, because our server fetches the address. It accepts public http or https files up to about 3 MB and refuses 127.0.0.1.

Can I convert the XML back to JSON?

Yes, use the XML to JSON converter, but do not expect the original file back. Null, empty strings, empty objects and one-item arrays look alike in the XML, so some detail is lost, so keep your original JSON.
Share on Social Media: