JSON to XML Converter Online - Free & Private
Paste JSON and get indented, well-formed XML. Arrays become repeated elements, keys that start with @ become attributes, and invalid characters in names are fixed so the XML always parses.
How to convert JSON to XML
- Paste JSON into the left editor, or open or drop a .json file.
- Indented XML appears on the right with syntax highlighting.
- Copy the XML or download it as an .xml file.
How JSON maps to XML
JSON and XML do not describe data in quite the same way, so the converter follows a small set of rules that are widely used and easy to predict:
- Keys become elements.
{"title": "Dune"}becomes<title>Dune</title>. - Arrays become repeated elements.
{"book": [{...}, {...}]}becomes two<book>elements side by side. - Keys that start with @ become attributes.
{"@id": "bk101"}becomesid="bk101"on the parent element. - A #text key becomes text content, so an element can have both attributes and a value.
nullbecomes an empty element such as<middleName/>.- Invalid names are fixed. XML names cannot contain spaces or start with a digit, so
"first name"becomesfirst_nameand"2026"becomes_2026. - Special characters such as
&,<and quotes are escaped.
If the JSON has exactly one top-level key, that key becomes the root element. Otherwise everything is wrapped in a root element whose name you choose.
Options
- Root name: the wrapping element used when the JSON does not name its own root.
- Array item: the element name for items of a top-level array, for example
<item>or<row>. - Indent: spaces per level.
- XML declaration: add or leave out the
<?xml version="1.0" encoding="UTF-8"?>line.
Example
{"catalog": {"book": [{"@id": "bk101", "title": "Dune"}]}} becomes:
<catalog>
<book id="bk101">
<title>Dune</title>
</book>
</catalog>
The same rules work in reverse in the XML to JSON converter, so a document survives the round trip.
Private by design
The conversion runs in your browser and your data is never uploaded.