JSON to XML / XML to JSON
Convert data formats instantly between structured JSON objects and nested XML markup strings.
All conversions happen locally in your browser. Your data is never sent to any server. The tool uses the native DOMParser API for XML parsing.
JSON and XML are the two most widely used data interchange formats on the web. APIs, configuration files, and enterprise systems often require converting between them. Our JSON to XML converter transforms structured JSON objects into well-formed XML markup, and the reverse XML to JSON converter parses XML back into clean, indented JSON — all in your browser.
Conversion Rules
JSON objects become nested XML elements. Each key becomes a child element tag.
JSON arrays are converted to repeated XML elements. The element name is the singular form of the parent key.
Strings, numbers, booleans, and null values become the text content of their parent XML element.
XML attributes are represented as properties with an @ prefix in JSON. Text content uses a #text key.
Example Conversion
JSON Input
{
"book": {
"title": "The Great Gatsby",
"author": "F. Scott Fitzgerald",
"year": 1925,
"genres": ["Fiction", "Classic"],
"inStock": true
}
} XML Output
<root>
<book>
<title>The Great Gatsby</title>
<author>F. Scott Fitzgerald</author>
<year>1925</year>
<genres>Fiction</genres>
<genres>Classic</genres>
<inStock>true</inStock>
</book>
</root>How to Use the Converter
- Select a direction — Choose JSON to XML or XML to JSON using the mode buttons.
- Paste your input — Enter your source data in the left panel.
- View the result — The converted output appears instantly in the right panel with proper indentation.
- Copy or download — Use the Copy button or download the output as a file.
Key Features
- Bidirectional Conversion
Convert both directions — JSON to XML and XML to JSON — with a single click.
- Array Handling
JSON arrays become repeated XML elements with intelligent singular naming.
- Attribute Support
XML attributes are preserved with @ prefix notation in the JSON output.
- Proper Indentation
Both JSON and XML outputs are beautifully indented for readability.
- XML Character Escaping
Special XML characters (&, <, >, ", ') are properly escaped.
- 100% Private
All processing happens locally. No data is uploaded anywhere.
Frequently Asked Questions
How are JSON arrays converted to XML?
"books": [...] becomes multiple <book> elements.How are XML attributes handled in JSON?
@ in the JSON output. Text content within elements with attributes uses a #text key. For example, <item id="5">Hello</item> becomes {"@id": "5", "#text": "Hello"}.