Kadben

Convert JSON to XML

Choose a JSON file or paste JSON to get indented, well-formed XML. The mapping is the same as in the XML to JSON tool, so you can convert in both directions.

Runs in your browser. Nothing is uploaded.

JSON to XML

Input
Options

The result appears here.

How to use it

  1. Choose a JSON file, drop it on the box, or paste JSON; the result appears at once.
  2. Set the root element name, the name for items of nested lists, the indentation and whether the XML declaration is added.
  3. Read the notes next to the result: they list renamed keys and other changes.
  4. Download the .xml file or copy the result.

Rules and limits

XML and JSON mapping

From JSON to XML

Questions and answers

Why is my data inside an extra <root> element?

An XML document has exactly one top element. When the JSON has several top-level keys or is an array, the page adds one; you can rename it in the options.

What if a key that starts with “@” holds an object?

An attribute can hold only text, so the object or array is written into it as JSON text, and a note says so.

What happens to arrays, null and empty strings?

An array becomes one element per item, each with the key’s name. Arrays inside arrays are wrapped in an element whose items are called “item” (you can change the name). null and "" become an empty element such as <note/>. An empty array produces no element.

What if a key is not a valid XML name?

Characters that XML names cannot contain are replaced with “_”, and a name that starts with a digit gets a “_” in front: “first name” becomes first_name and “1st” becomes _1st. The notes next to the result list the renamed keys.

Which characters are escaped?

&, < and > in text, and &, <, " as well as tabs and line breaks in attribute values. Control characters that XML 1.0 does not allow, such as U+0001, stop the conversion with the path of the value.

Related tools