Want a Custom tool for Yourself?

Need a Custom Tool? We build custom tools that can save hours per employee per day.

JSON to XML

Convert JSON to XML in one step. Paste JSON, generate XML output instantly, then copy it for configs, feeds, and integrations. Easy to copy and paste.

JSON to XML

OR



Last updated: June 6, 2026

Created by: Eon Tools Dev Team

Reviewed by: Sugam Baskota



What this does

So something you are working with speaks XML, not JSON. Maybe it is an older system, a data feed, or a config format that expects angle brackets. This converts your JSON across. Paste it or upload a .json file, press Convert, and you get an XML version you can copy out.

How to use it

  1. Paste your JSON, or upload a .json file.
  2. Press Convert.
  3. Copy the XML from the output box.

How it works

The tool walks through your JSON and rewrites it as XML. Each key becomes an element with its value inside, an object becomes a set of nested elements, and a list repeats its element once for each item. Text values are escaped so characters like & and < stay valid, and the whole result is wrapped in a single <root> element with an XML declaration on top, so what you get is well formed and ready to use. It does not lean on an outside library, it builds the markup directly, and it all happens in your browser, so the JSON you paste is not uploaded anywhere.

What to expect from the mapping

JSON and XML describe data in slightly different shapes, so a few things are worth knowing about how the mapping turns out.

Because XML needs a single top level element, the tool wraps everything in one <root> element. If you would rather it was called something else, just rename that wrapper after converting.

Lists are handled by repeating the element. A key with three values becomes that same tag three times in a row, one per value. If the very top level of your JSON is a list rather than an object, those items come out under generic <item> tags, since there is no key to name them.

XML is also stricter than JSON about names. A tag cannot contain spaces or start with a digit, so keys like first name or 123 are adjusted to keep the output valid: spaces become underscores, and a leading digit gets an underscore in front. The tags stay close to your keys, just tidied up enough to be legal.

Finally, the output comes out as a single compact line. If you want it laid out neatly, run it through an XML formatter.

A quick example

Here is a JSON object with a nested object and a list inside it:

{"book": {"title": "Dune", "tags": ["sci-fi", "classic"]}}

And the XML it becomes:

<?xml version="1.0" encoding="UTF-8" ?><root><book><title>Dune</title><tags>sci-fi</tags><tags>classic</tags></book></root>

Notice the single <root> wrapper, the nested <book> element, and the <tags> element repeated once for each item in the list.

Questions people ask

Why is everything wrapped in a root element?

XML has to have a single top level element to be valid, so the tool wraps the whole result in one <root> element. If you want a different name, rename it after converting.

How are lists converted?

Each item in a list repeats its element, so a key with several values becomes that tag several times. A list at the very top level uses <item> tags, since there is no key to take the name from.

What happens to keys with spaces or numbers?

XML tag names cannot contain spaces or start with a digit, so the tool adjusts them to stay valid: spaces become underscores and a leading digit gets an underscore in front. The result reads close to your original key.

Do I need to escape special characters?

No. The tool escapes the XML special characters, &, <, >, " and ', in your values for you, so the output stays valid.

Is the XML indented?

No, it comes out as one compact line. If you want it laid out neatly, run the result through an XML formatter.

Is my JSON uploaded?

No. The conversion runs entirely in your browser, so nothing you paste or upload is sent away.

References

  1. World Wide Web Consortium. Extensible Markup Language (XML) 1.0. https://www.w3.org/TR/xml/
  2. MDN Web Docs. JSON.parse(). https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse


Sugam Baskota

Sugam Baskota is a senior software engineer and Computer Science graduate from UT Arlington, with interests in user scripts, browser extensions, developer tooling, and productivity systems. He spends time building practical utilities and extensions in the kinds of workflows Eon is designed to simplify. At Eon Tools, he reviews useful, password, and developer tools.