JSON to XML Converter

Turn JSON into well-formed XML, or XML back into JSON, with control over the root element, arrays and attributes.

FreeNo sign-upPrivate — runs in your browser
0Elements
0Depth
0Output size

How to use the JSON to XML Converter

  1. Paste JSON or XMLChoose the direction, then paste your data or open a file. The tool switches direction if you open the other type.
  2. Set the optionsName the root element, choose whether arrays repeat the tag or are wrapped in <item>, and pick the indent.
  3. Copy or downloadThe result updates as you type. Copy it or download it as .xml or .json.

Example

{"tags": ["paper", "school"]} becomes <tags>paper</tags><tags>school</tags> with “Repeat the tag”.

A key that starts with @, such as "@id": "P1", becomes an attribute: <products id="P1">. The sample JSON gives 15 elements.

Frequently asked questions

How are JSON arrays written in XML?

XML has no arrays, so there are two common styles. “Repeat the tag” writes one element per item with the same name. “Wrap in item” keeps a parent element and writes each value as &lt;item&gt;. A top-level array is always wrapped.

How do I create XML attributes?

Start the key with @. {"book": {"@id": "1", "title": "X"}} becomes &lt;book id="1"&gt;&lt;title&gt;X&lt;/title&gt;&lt;/book&gt;. Use "#text" for text next to attributes.

What happens to invalid tag names?

XML names cannot contain spaces or start with a digit. Spaces and symbols become _, and names starting with a digit get a _ in front, so "2024 sales" becomes &lt;_2024_sales&gt;.

How is XML turned into JSON?

Attributes become keys with @, repeated elements become arrays, and text inside an element with attributes becomes "#text". Numbers and true/false are detected unless you turn that off.

Popular posts from this blog

Character Counter

Speech to Text Online

Keyboard Tester