Repeated elements become arrays
When siblings share a tag name, their converted values are collected in document order. A single child remains a scalar or object, which keeps common output compact.
Parse XML documents and convert them to equivalent JSON structure with attributes.
Enter the XML data you want to convert to JSON.
See the JSON output generated automatically from the XML.
Click copy to grab the converted JSON output.
XML and JSON model documents differently, so conversion requires explicit conventions. This tool parses elements, text, repeated child elements, and attributes into a JavaScript object before serializing it as JSON. Attributes use an @_ prefix and mixed text uses #text so those values are not confused with child elements.
A concrete input and expected output from the current implementation.
Input
<note id="7"><to>Bee</to><priority>high</priority></note>
Expected output
{
"note": {
"@_id": "7",
"to": "Bee",
"priority": "high"
}
} The id attribute is kept separately from child elements. Each child appears once, so its value is represented directly instead of as an array.
When siblings share a tag name, their converted values are collected in document order. A single child remains a scalar or object, which keeps common output compact.
Elements, attributes, comments, CDATA, common entities, and basic declarations are handled. Advanced namespace processing, DTD validation, and full XML Schema validation are outside its scope.
No. XML has attributes, namespaces, mixed content, and ordering rules that do not map uniquely to JSON. Always document the convention used by a converter.
The same child tag appeared more than once under its parent. The array preserves every occurrence and its order.
The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.
Convert CSV data into structured JSON arrays or objects with automatic type detection.
Transform JSON arrays and objects into downloadable CSV spreadsheet format.
Convert YAML configuration files to JSON format with validation and formatting.
Convert tab-separated values to comma-separated format with proper escaping.
Convert numbers between binary, octal, decimal, and hexadecimal bases.
Convert between Roman numerals and Arabic numbers with validation.