DuckyTools
Home Convert JSON to XML

JSON to XML Convert

Convert a JSON document into equivalent XML markup.

JSON to XML is a free online tool that convert a JSON document into equivalent XML markup. It runs entirely in your web browser using plain JavaScript, so files are processed on your own device and never uploaded to a server. There is no sign-up, no file size limit imposed by the site, no watermark and no paid tier.

Price
Free — no account, no quota, no watermark
Category
Convert
Where it runs
In your browser, on your device
Files uploaded
None
Technology
plain JavaScript
Settings
2
Works offline
Yes, after the first visit

About JSON to XML

The two formats do not map cleanly, and the conversion has to make choices you should know about. JSON arrays have no XML equivalent, so each element is emitted as a repeated element. JSON keys can contain characters that are illegal in XML element names — spaces, leading digits — and are sanitized. Nothing here converts back losslessly, which is a property of the formats rather than the tool.

How to use it

  1. Paste the text you want to run through json to xml.
  2. Set root element and include xml declaration.

The 2 settings

SettingWhat it doesDefault
Root elementFree text.root
Include XML declarationOn or off. On by default.On

Under the hood

Runs onplain JavaScript — runs the whole thing
ControlsRoot element, Include XML declaration

Questions

Why do array items become repeated elements?

XML has no array type. A list of three items becomes three sibling elements with the same name, which is the standard convention and how most XML consumers expect to read a collection.

Can I round-trip JSON through XML?

Not reliably. Type information is lost — XML has no distinction between the number 5 and the string "5" without a schema — so a round trip returns everything as strings.