⚡
usefultools.dev
J→X

JSON to XML Converter

NEW

Convert JSON to XML in your browser: set the root name, array style, @attributes, declaration and indentation.

Runs 100% in your browser — your input is never uploaded or stored on our servers.

Options
Open XML → JSON tool

Conventions: a key that starts with @ becomes an attribute ({"@id": 7} → id="7"); the key #text is the text of an element that also has attributes or children; null and empty values become an empty element (<a/>); a top-level array is written as <item> elements inside the root. Names that XML does not allow (spaces, a leading digit) are renamed and listed in a notice.

⚡

Quick Examples

Typical inputs and the results this tool produces.

Minified
{"note":{"to":"Ann","from":"Bob"}}
<?xml version="1.0" encoding="UTF-8"?><note><to>Ann</to><from>Bob</from></note>
Attribute, no declaration
{"book":{"@id":7,"title":"Dune"}}
<book id="7"><title>Dune</title></book>
Repeated, minified
{"palette":{"colors":["red","green"]}}
<palette><colors>red</colors><colors>green</colors></palette>
<item>, minified
{"palette":{"colors":["red","green"]}}
<palette><colors><item>red</item><item>green</item></colors></palette>
📖

Overview

JSON to XML Converter writes a JSON document as well-formed XML. Objects become nested elements, values are escaped (& < > and quotes), and you decide the root element name, whether to add an XML declaration, and whether the output is pretty-printed or minified.

JSON has arrays and XML does not, so you choose how they appear: repeat the parent name for each entry, or wrap entries in <item> elements. A key that starts with @ becomes an attribute and #text holds the text of an element that also has attributes. Keys that XML forbids are renamed and listed in a notice.

It runs in your browser; your JSON is not uploaded.

Why use this tool?

  • Produces escaped, well-formed XML for SOAP, feeds and legacy systems
  • Both common array conventions are available
  • Attributes and mixed text are possible with @ and #text keys
  • Invalid element names are repaired and reported, not silently broken
⭐

Features

🌱

Root name

Set the root element, or let a single top-level key become the root.

📚

Array style

Repeat the element name for each item, or wrap items in <item>.

@

Attributes

Prefix a key with @ to write it as an attribute; use #text for element text.

🛡️

Escaping and names

Special characters are escaped and illegal names are renamed with a notice.

🧾

Declaration and indent

Toggle the XML declaration; pretty-print with 2 spaces, 4 spaces, tab, or minify.

⬇️

Copy or download

Copy the XML or save a .xml file.

🛠️

How to Use

1

Add your JSON

Paste or open a .json file, or press Load sample.

2

Set the root and arrays

Type a root name and choose how arrays are written.

3

Mark attributes

Write {"@id": 7} to get id="7" on the element, and "#text" for element text.

4

Copy or download

Pick the output style, then Copy or Download .xml.

🤔

Frequently Asked Questions