The XML to JSON converter parses XML documents and converts them to JSON format using the browser's native DOM parser. Attributes are converted to @-prefixed properties, text nodes to #text properties, and nested elements to nested objects or arrays.
JSON output will appear here...
How to Convert XML to JSON
XML remains common in enterprise APIs, SOAP services, configuration files, and data feeds. Converting XML to JSON makes it easier to work with in JavaScript and modern REST APIs.
Attribute and Text Node Handling
XML attributes become @attributeName properties. When an element has only text content, the text becomes the value directly. When it has both attributes and text, the text is stored as #text. Multiple elements with the same tag name become a JSON array.
Frequently Asked Questions
Is this XML to JSON converter free?
Yes, completely free with no signup. All conversion runs locally in your browser.
How are XML attributes converted?
XML attributes are converted to JSON properties prefixed with '@' (e.g., <tag id='1'> becomes {"@id": "1"}). This follows the common XML-to-JSON convention used by many libraries.
How are text nodes handled?
When an element has both attributes and text content, the text is stored as a '#text' property. When an element has only text content and no attributes, the text becomes the property value directly.
Can this handle large XML files?
Yes, for moderate-sized XML documents. Since processing runs in your browser, very large files (10MB+) may be slower. For production processing of large XML files, use a server-side XML parser.
Are XML namespaces supported?
Namespace prefixes are preserved in property names (e.g., 'ns:element' becomes 'ns:element'). Namespace declarations (xmlns) are converted to '@xmlns' properties.