Convert XML to JSON Online
Modern web applications and APIs almost universally use JSON, but many legacy systems, enterprise services, and data sources still produce XML. Converting XML to JSON lets you work with the data in JavaScript, Python, and other languages without an XML parser. This tool parses XML and outputs a JSON representation that preserves the element hierarchy, text content, and attributes. Attributes are represented as JSON properties, child elements become nested objects, and repeated sibling elements become arrays. The output is formatted and ready to use with JSON tools like json-formatter or json-path-tester. Converting SOAP responses, RSS feeds, Android manifest files, and other XML sources to JSON is a common development task that this tool handles instantly in your browser.
FAQ
- How are XML attributes converted to JSON?
- XML attributes are included as properties in the JSON object, often prefixed with @ to distinguish them from child elements. For example, <item id="1"> becomes {"@id": "1"}.
- What happens with mixed content (text and child elements)?
- Mixed content elements have both a text value and child objects. The text content is typically stored under a special key like #text alongside the child element properties.
- Can this parse XML with namespaces?
- Yes. Namespace prefixes are preserved in the property names of the JSON output, maintaining the semantic meaning of the original XML.