Skip to content
T
Tools.Town
Free Online Tools for Everyone
<root><a>1</a></root>

JSON to XML Converter

100% Free

Convert JSON to well-formed XML — configurable root element, repeated elements for arrays, escaped special chars, optional XML declaration.

Real-time
Client-Side
Well-formed
Root element name
Indent
XML output
Paste JSON above to convert to XML…

Embed This Tool

Easy to Embed

Add JSON to XML Converter to your website or blog in seconds.

  • Responsive design
  • Lightweight & fast
  • No backend required
  • Always up-to-date
<iframe
  src="https://tools.town/embed/json-to-xml/"
  width="100%"
  height="600"
  style="border:none; border-radius:12px;"
  loading="lazy"
  title="JSON to XML Converter">
</iframe>

Share This Tool

Share Instantly

Share JSON to XML Converter with anyone — no login required.

  • Shareable link
  • No login required
  • Works on any device
  • No account needed

Share via

Advertisement

How to Use

  1. 1 Paste JSON into the input box (or click 'Load sample')
  2. 2 Set a root element name (defaults to 'root')
  3. 3 Pick indent — 0 (minify), 2-space, or 4-space
  4. 4 Toggle XML declaration on/off
  5. 5 Copy the XML output instantly

Features

  • Pretty-printed or minified XML output
  • Configurable root element name
  • Arrays under a key produce repeated elements with that key as the tag
  • Special chars (& < >) auto-escaped to entities
  • Invalid XML element names auto-sanitised (e.g. '123' → '_123')
  • Optional `<?xml version=1.0 ?>` declaration

Why it Matters

Legacy systems still speak XML — SOAP APIs, RSS feeds, Android resource files, Office Open XML, SVG. Most modern data lives in JSON. A reliable converter saves you from writing one-off transform scripts every time you need to bridge an old system to a new one.

★★★★★

Use Cases

SOAP API Testing

Compose JSON, send as XML to a legacy SOAP endpoint

RSS Feed Generation

Convert blog posts JSON into an RSS-style XML feed

Android Resources

Translate JSON config into Android XML resource files

Frequently Asked Questions

How are arrays represented in XML?
An array under a key produces repeated elements with that key as the tag name. So `{users: [{name: 'a'}, {name: 'b'}]}` becomes `<users><name>a</name></users><users><name>b</name></users>`.
What happens to invalid XML element names?
JSON keys like '123abc' or 'user-id' aren't always valid XML names. Invalid characters become underscores; names starting with a digit get a leading underscore. So '123' → '_123'.
Does this support XML attributes?
Not currently — every value becomes an element. Convention for attribute mapping (e.g. `@attr` keys) is implementation-specific; we kept the mapping simple.
Why doesn't my XML have any indentation?
Check the Indent setting. '0' (Minify) produces single-line XML. Pick '2 sp' or '4 sp' for pretty-printed output.

Related Tools You Might Like

Browse more free tools