
Need the opposite? Convert JSON to XML
Convert XML into structured JSON directly in your browser. Paste XML or upload a local .xml file, choose how attributes, arrays, text, and values should be represented,
then copy or download the JSON result.
XML Input
Paste XML or load a local file.
JSON Output
—
XML parsing and JSON generation happen locally in this browser. No conversion library, upload service, or server request is required.
XML to JSON Converter
This XML to JSON converter turns XML documents into structured JSON directly in your browser. Paste XML or open a local XML file, choose the mapping options, and copy or download the result.
How XML Is Mapped to JSON
XML and JSON model data differently, so there is no single official XML-to-JSON representation.
This converter uses predictable rules: element names become object keys, repeated sibling
elements become arrays, attributes use an @ prefix, and element text uses #text when the value also needs attributes or child data.
For example:
<book id="101"> <title>Example Book</title> <price currency="USD">19.95</price> </book>
with the default options becomes approximately:
{
"book": {
"@id": "101",
"title": "Example Book",
"price": {
"@currency": "USD",
"#text": "19.95"
}
}
}How to Convert XML to JSON
- Paste XML into the editor or upload a local
.xmlfile. - Choose how attributes, arrays, empty elements, whitespace, and values should be represented.
- Click Convert XML to JSON.
- Review the diagnostics and generated JSON.
- Copy the result or download it as a
.jsonfile.
Attributes and Repeated Elements
When attributes are enabled, an attribute such as id="42" becomes "@id": "42". Repeated sibling elements with the same qualified name
automatically become arrays. An optional setting can force every child element name
to use an array even when it appears only once.
Text, CDATA, and Mixed Content
Simple text-only elements can be compacted directly to strings. CDATA is treated as text.
If an element contains both direct text and child elements, the direct text is stored under #text. Because this is an object-style mapping, the exact interleaving order
between mixed text and child elements is not retained; the tool reports mixed-content
elements so that limitation is visible.
XML Values Stay Strings by Default
XML text does not inherently distinguish 00123 from a string identifier.
Type inference is therefore disabled by default. If enabled, exact boolean, null, and
unambiguous numeric values can be converted to native JSON scalar types.
DOCTYPE Declarations
This browser converter rejects XML documents containing a real DOCTYPE declaration. DTD and entity-expansion behavior is unnecessary for ordinary data conversion
and is intentionally outside the scope of this tool.
Private Browser-Side Conversion
The converter uses the browser's built-in XML parser and JavaScript JSON serializer. The XML document does not need to be uploaded to Flipper File or sent to a third-party conversion service.
