Skip to content

JSON to XML

Convert JSON to XML format.

Loading…

About JSON to XML

Systems that still expect XML need your JSON reshaped into tags. Paste an object or array and you get an indented document that starts with an XML declaration and wraps everything in a root element. Each key becomes an element, an array repeats the same element once per item, null becomes an empty tag, and ampersands and angle brackets in text are escaped. Keys that are not legal XML names are rewritten with underscores, so the output is always well-formed.

Features

  • XML declaration and a root wrapper added automatically
  • Arrays repeat the key's element once per item
  • A top-level array, or an array inside an array, uses item elements
  • Keys that are not valid XML names are rewritten with underscores
  • Ampersands, angle brackets and quotes in text are escaped
  • Null values become empty self-closing elements

Limitations

  • No attributes are produced: a key such as @id becomes an element named _id, not an attribute.
  • The wrapper element is always called root and cannot be renamed on the page.
  • A one-item array and a single value look the same in XML, so converting the XML back to JSON will not recover the array.
  • Download saves the text as output.txt and needs a free account, and JSON nested more than 1,000 levels deep is refused.

How it works

  1. Paste your JSON into the JSON Input panel.
  2. Select Convert to XML.
  3. Check the XML Output panel; it begins with the declaration and a root element.
  4. Copy the result with Copy Output, or use Download to save it.
  5. Press Clear All to convert something else.

Example input

{
  "book": { "title": "Auro Guide", "tags": ["json", "xml"] }
}

Frequently asked questions