
Everything runs in your browser. Your JSON and files are never uploaded to Flipper File.
Convert JSON to XML
Paste JSON or load a file, and this converter writes it out as XML as you type. Keys that start with @ become attributes, arrays become repeated elements, and keys that aren't allowed as XML names are fixed automatically. If the JSON has a mistake, you get the exact line and column and a plain explanation of what's wrong.
How to use it
- Paste JSON into the box on the left, click Load file, or drop a .json file onto the box.
- The XML appears on the right as you type.
- Set the root element name, choose whether to include the XML declaration, and pick an indent size.
- Click Copy, or Download to save an .xml file.
How JSON maps to XML
- Each key becomes an element, and its value becomes the element's content.
- An array becomes one element for each item, all using the key's name.
"tag": ["a", "b"]becomes<tag>a</tag><tag>b</tag>. - Keys that start with
@become attributes, and"#text"becomes the element's text. - Numbers and
true/falsebecome text, andnullbecomes an empty element. You can leave nulls out instead under More options.
For example, this JSON:
{
"book": {
"@id": "bk101",
"title": "Writing Clean XML",
"price": { "@currency": "USD", "#text": 44.95 },
"tags": ["xml", "reference"]
}
}becomes this XML:
<?xml version="1.0" encoding="UTF-8"?>
<book id="bk101">
<title>Writing Clean XML</title>
<price currency="USD">44.95</price>
<tags>xml</tags>
<tags>reference</tags>
</book>Choosing the root element
Every XML document needs exactly one root element. If your JSON is an object with a single top-level key, like {"book": {...}}, that key becomes the root. Otherwise, everything is wrapped in an element named by the Root element setting, which is root by default. A top-level array becomes a root element with one <item> per entry, and you can change that name under More options.
Keys that aren't valid XML names
XML element names can't contain spaces or most symbols, and they can't start with a number. JSON keys can be anything, so the converter replaces invalid characters with underscores and adds a leading underscore when needed. For example, "first name" becomes <first_name>, and "2024" becomes <_2024>. A note tells you when any keys were renamed.
Special characters and CDATA
Characters that have meaning in XML, like &, <, and >, are escaped automatically, so "Night & Day" becomes Night & Day. If you'd rather keep text that contains markup readable, turn on CDATA for text with markup to wrap those values in CDATA sections instead.
Fixing JSON errors
When the JSON isn't valid, the converter pinpoints the problem and explains it, like a missing comma between two properties, a property name without double quotes, or a string that's never closed. Comments and trailing commas, two very common problems in hand-edited JSON, are removed automatically, and a note lets you know.
Converting XML back to JSON
The XML to JSON Converter uses the same @ and #text conventions, so XML made here converts back into the same JSON structure.
Frequently asked questions
Is my JSON uploaded anywhere?
No. The conversion runs entirely in your browser.
How are nested arrays handled?
An array inside another array becomes an element that wraps one <item> per value, so "grid": [[1, 2], [3, 4]] becomes two <grid> elements, each with two <item> children.
Does it keep number formatting like 1.50?
Yes, in current versions of most browsers, which give the converter the exact text of each number. In older browsers, numbers are written the way JavaScript prints them, so 1.50 becomes 1.5.
How do I add a namespace?
Add it as an attribute key, like "@xmlns": "http://example.com/ns" or "@xmlns:dc": "http://purl.org/dc/elements/1.1/", on the root object.
What happens to empty arrays?
They're left out, since XML has no way to write an empty list of repeated elements. An empty object becomes an empty element.
Our Full Dev Tool Library
[tcb_post_categories css='tve-u-19c7b8d2c16' link='1' rel='0' target='0' inline='1' static-link='{"className":"","href":"https://flipperfile.com/category/developer/","title":"Developer","data-css":"tve-u-19c7b8d2c16","class":""}' link-css-attr="tve-u-19c7b8d2c16"]
