JSON to XML
Convert JSON into well-formed XML markup instantly in your browser. Object keys prefixed with @ become attributes; everything else becomes nested elements.
Well-Formed Output
Produces properly escaped, indented XML with a single root element every time.
Handles Large Documents
Converts JSON up to 50MB without freezing the page.
Local Processing
Your data never leaves your browser. Privacy first conversion.
How to Convert JSON to XML
- Paste valid JSON into the input pane.
- Prefix any key with @ where you want an XML attribute instead of a child element — everything else becomes nested elements.
- Click Convert.
- Well-formed, indented XML with a declaration and a single root element appears in the output pane.
Example: Attributes, Elements, and Repeated Tags
Input — JSON with an @-prefixed key and an array
{"book":{"@id":"bk-101","title":"Clean Data","authors":{"author":["R. Vance","M. Osei"]}}}Output — XML
<?xml version="1.0" encoding="UTF-8"?>
<book id="bk-101">
<title>Clean Data</title>
<authors>
<author>R. Vance</author>
<author>M. Osei</author>
</authors>
</book>
The single top-level key becomes the root element, @id becomes an id attribute, and the two-item array becomes two repeated <author> elements.
The mapping rules in one breath
Object keys become element names, @-prefixed keys become attributes on the parent element, arrays repeat their parent tag once per item, and primitive values become text content. Because XML requires exactly one root, a document whose top level is a single key uses that key as the root element.
Escaping is handled for you
Characters with special meaning in XML — angle brackets, ampersands, quotes in attribute values — are escaped automatically during conversion, so string values containing markup-like text produce well-formed output instead of a broken document that chokes the next parser downstream.
Frequently Asked Questions
Prefix the key with @ — {"user": {"@id": "5", "name": "Alice"}} produces <user id="5"><name>Alice</name></user>. Any key without the @ prefix becomes a nested child element instead. This is the one convention worth remembering since JSON and XML don't map onto each other automatically.
XML documents can only have a single root element, but a JSON object can have any number of top-level keys — so if there is exactly one, it becomes the root tag; if there are two or more (or the top level is an array), everything gets wrapped in a synthetic <root> element instead, since there is no other valid way to represent it.
Each item in the array becomes its own sibling element with the same tag name — {"tags": {"tag": ["a", "b"]}} becomes <tags><tag>a</tag><tag>b</tag></tags>, not a single element containing a list. Converting that XML back to JSON (via XML to JSON) recognizes repeated sibling tags and turns them back into an array automatically.
No. The conversion runs entirely in your browser — nothing you paste here is ever transmitted anywhere.
No — text and attribute values are escaped automatically (& becomes &, < becomes <, and so on), so any string value converts to valid, well-formed XML regardless of what characters it contains.
Related Tools
XML to JSON
Convert XML documents into structured JSON.
JSON Formatter
Make messy, minified JSON readable with customizable indentation.
JSON Validator
Check JSON validity with precise line/column errors.
Base64 Decoder
Decode Base64 text back to readable Unicode instantly.
URL Encoder
Safely percent-encode text for use in URLs and query strings.
JSON to YAML
Convert JSON documents to clean, indented YAML.