J→X

JSON to XML

Convert JSON into well-formed XML, following the @attribute / #text convention.

json-to-xml.tool
Root tag
Item tag
0 chars
XML output will appear here
Nothing you paste here is ever sent to a server - conversion happens locally in your browser.
Overview

What is a json to xml?

This tool converts JSON back into XML, following the same @attribute and #text convention used by XML to JSON - so round-tripping data between the two formats produces consistent, predictable results. Arrays become repeated sibling elements automatically.

Quick start

How to use this tool

  1. 1Paste JSON shaped like { "root": { ... } }, or upload a .json file.
  2. 2If your JSON has more than one top-level key, set a Root tag name to wrap them under a single element.
  3. 3Click Convert to generate well-formed XML with proper indentation.
  4. 4Copy the XML or download it as a .xml file.
Where it helps

Common use cases

Converting a JSON API response into XML for a system that requires it
Generating XML config files from structured JSON data
Round-tripping data extracted with XML to JSON back into valid XML
Producing XML test fixtures from hand-written JSON
Good to know

Frequently asked questions

How do I add XML attributes from JSON?

Use a key prefixed with @, like { "@id": "42" } - it becomes an id="42" attribute on that element rather than a child element.

How do I set element text content alongside attributes?

Use a #text key - for example { "@currency": "USD", "#text": 29.99 } produces <price currency="USD">29.99</price>.

What does the Root tag field do?

If your JSON has a single top-level key, that key becomes the XML root element automatically and the Root tag field is ignored. If there are multiple top-level keys, they're wrapped inside an element named after the Root tag field.

Is special XML content escaped correctly?

Yes - characters like &, <, >, and " are escaped in text and attribute values so the output is always valid XML.

quick_facts.json

{

"runs_in_browser": true,

"data_sent_to_server": false,

"signup_required": false,

"price": "free",

"category": "Encoding"

}

Related tools

B64
No signup
Base64 Encoder

Encode text to Base64, with correct Unicode handling.

Open tool
B64
No signup
Base64 Decoder

Decode Base64 back to readable text, with correct Unicode handling.

Open tool
URL
No signup
URL Encoder

Percent-encode URLs and query strings, component or full-URI mode.

Open tool