Converter

JSON ⇄ XML

Convert either direction with attributes preserved: XML attributes become @-prefixed keys and text content becomes #text, so the round trip keeps its meaning.

Input
Waiting for input.
Output

XML parsing uses the browser’s own DOMParser — no external library, and no entity expansion beyond what the browser allows. ⌘/Ctrl + Enter runs it again. Everything happens in this browser — nothing is uploaded.

About the JSON ⇄ XML converter

SOAP services, RSS feeds and older enterprise systems still speak XML. Converting between the two formats is lossy unless attributes are handled properly, so this maps XML attributes to @-prefixed keys and text content to #text, which means the round trip keeps its meaning. XML parsing uses the browser's own DOMParser rather than a hand-rolled parser.

How to use it

  1. Paste JSON or XML — the direction is detected from the first character.
  2. Set the root element name (used when your JSON has more than one top-level key) and the indentation.
  3. Copy or download the converted document.

Questions

How are XML attributes represented in JSON?

As keys prefixed with @ — so <item sku="K"> becomes {"@sku": "K"}. Element text alongside attributes becomes "#text". Converting back turns them into real attributes again.

What happens to repeated elements?

Repeated sibling elements with the same name become a JSON array, and an array in JSON becomes repeated elements on the way back.

Does my JSON need a single root?

XML does. If your JSON has one top-level key it is used as the root element; otherwise the document is wrapped in the root element you name.