
Everything runs in your browser. Your XML and files are never uploaded to Flipper File.
Convert XML to JSON
Paste XML or load a file, and this converter turns it into JSON as you type. Attributes, repeated elements, CDATA, and namespaces are all handled, and if the XML has a mistake, you'll see the exact line and column along with a plain explanation of how to fix it. You can copy the JSON or download it as a .json file.
How to use it
- Paste XML into the box on the left, click Load file, or drop an .xml, .rss, .svg, .kml, or other XML file onto the box.
- The JSON appears on the right as you type. Choose whether to include attributes, always use arrays, or detect numbers and booleans.
- Pick an indent size, or Minified for the smallest output.
- Click Copy, or Download to save a .json file.
How XML maps to JSON
XML and JSON are built differently, so there's no single official way to convert between them. This converter uses the most common conventions:
- Each element becomes a key, and an element that only holds text becomes a string, like
"title": "Writing Clean XML". - Attributes become keys that start with
@, like"@id": "bk101". - When an element has attributes or child elements as well as text, the text goes under
"#text". - Elements that repeat inside the same parent become an array.
- Empty elements like
<note/>become an empty string. You can switch this tonullor{}under More options.
For example, this XML:
<book id="bk101">
<title>Writing Clean XML</title>
<price currency="USD">44.95</price>
</book>becomes this JSON:
{
"book": {
"@id": "bk101",
"title": "Writing Clean XML",
"price": {
"@currency": "USD",
"#text": "44.95"
}
}
}Arrays: one item vs. many
An element becomes an array only when it repeats. That means a <tags> element with two <tag> children gives you an array, but one with a single <tag> gives you a plain string, which can break code that expects a list. Turn on Always use arrays to make every child element an array, so the shape stays the same no matter how many items there are. The converter points this out when it happens in your file.
Numbers and booleans
Everything in XML is text, so by default every value stays a string. That's the safe choice, since values like ZIP codes, IDs, and phone numbers can look like numbers but shouldn't be treated as them. Turn on Detect numbers and booleans to convert exact numbers, true, false, and null into JSON types. Values that would change when converted, like 007 or 1.50, always stay as strings.
Namespaces, CDATA, and comments
Namespace prefixes stay in the key names, like "dc:creator", and namespace declarations are kept as @xmlns attributes. Choose Remove namespace prefixes for cleaner keys like "creator". CDATA sections are read as normal text. Comments and processing instructions are skipped.
If an element mixes text with child elements, like a paragraph with bold words inside it, the text is collected under "#text", but its position between the child elements can't be kept. The converter warns you when that happens.
Fixing XML errors
XML has to be well-formed before it can be converted. When it isn't, the converter shows the line and column of the problem, a snippet of the line with a marker, and a Show in input button that jumps to it. Common causes:
- HTML entities like
, which XML doesn't define. Use instead. - A bare
&in text. It must be written as&. - More than one top-level element. XML needs a single root element around everything.
- A closing tag that doesn't match its opening tag, or one that's missing.
Converting JSON back to XML
The JSON to XML Converter uses the same @ and #text conventions, so JSON from this page converts back into equivalent XML.
Frequently asked questions
Is my XML uploaded anywhere?
No. The XML is parsed with your browser's built-in parser, and nothing you paste or load leaves your device.
Can it convert RSS feeds, sitemaps, SVG, or KML files?
Yes. Any well-formed XML works, including RSS and Atom feeds, XML sitemaps, SVG images, KML and GPX files, and config files.
Why is my number in quotes?
XML doesn't have number types, so values stay strings unless you turn on Detect numbers and booleans. Even then, values like 007 stay strings so no digits are lost.
Does it support DOCTYPE declarations?
Yes, a DOCTYPE is fine. Documents that define their own entities inside the DOCTYPE are rejected, because custom entities can be used to freeze or crash a browser tab.
How large a file can I convert?
Files up to 25 MB. For very large inputs, the live preview pauses and a Convert button appears so the page stays responsive.
Our Full Dev Tool Library
[tcb_post_categories css='tve-u-19c7b6db4b3' link='1' rel='0' target='0' inline='1' static-link='{"className":"","href":"https://flipperfile.com/category/developer/","title":"Developer","data-css":"tve-u-19c7b6db4b3","class":""}' link-css-attr="tve-u-19c7b6db4b3"]
