JSON to XML Converter

Paste JSON and get well-formed XML instantly — with a configurable root element and attribute convention.

XML output

🔒 Your data never leaves your browser — all conversion happens locally.

How to use the json to xml converter

  1. Paste your JSON into the left panel — a working example is preloaded.
  2. If your top-level JSON is an array or a single value, set the root element name to wrap it.
  3. Adjust the attribute prefix and pretty-print if needed.
  4. Read the converted XML on the right, updated live as you type.

How it works

This converter uses the same convention as the XML to JSON converter, in reverse: keys prefixed with @_ become XML attributes, and a #text key becomes element text content. If your JSON's top level is a plain object (like the output of the XML to JSON converter), its keys become root-level XML tags directly — this is what makes round-tripping between the two converters exact. If your top level is an array or a single value instead, it gets wrapped in the root element name you specify, since XML always needs a named container.

Examples

InputResult
{"note":{"to":"Tove","from":"Jani"}}<note><to>Tove</to><from>Jani</from></note>
[1, 2, 3] with root name "list"<list>1</list><list>2</list><list>3</list>

Frequently asked questions

Is my JSON uploaded anywhere?

No — the conversion happens entirely in your browser.

How do I set the root element?

If your JSON top level is already an object (e.g. {"note": {...}}), its key is used as the root tag directly and the "Root element name" field is ignored. If your top level is an array or a plain value, that field names the wrapper element.

How do JSON arrays map to XML?

Each item in an array becomes a repeated XML tag with the same name — the inverse of how the XML to JSON converter groups repeated tags into arrays.

Can I change how attributes are written?

Yes — the attribute prefix defaults to @_ (matching the XML to JSON converter's convention) but you can change it to anything you like.

What happens if my JSON is invalid?

You get the exact SyntaxError message from the JSON parser so you can find and fix the problem.