XML to JSON Converter — Free Online Parser
Transform XML documents into structured JSON instantly in your browser. Handles attributes, repeated elements, namespaces, RSS feeds, and SOAP responses. Choose how attributes appear in the output and download the result with one click.
How to Convert XML to JSON Online
- Paste your XML into the left input panel. The tool uses the browser's built-in DOMParser for accurate, standard-compliant parsing.
- Choose Attribute handling — @ prefix stores attributes as
@id, Merge places them directly on the object, Ignore discards them. - Toggle Pretty print for indented output or Minify for a compact single-line string.
- Check the element count, attribute count, and max depth stats in the bar above the output.
- Click Copy JSON to copy to clipboard or Download .json to save the file.
Key Features
- Uses the browser's native DOMParser — catches malformed XML with exact error messages
- Three attribute handling modes: @ prefix, merge, or ignore
- Repeated sibling elements automatically collected into JSON arrays
- Leaf-element text becomes the value directly; mixed content stored under _text key
- Element count, attribute count, and max depth statistics
- Pretty print and minify toggle for output control
- Download as .json or copy to clipboard
- 100% browser-based — XML never leaves your device
XML to JSON Use Cases
Converting RSS or Atom feeds to JSON
RSS and Atom are XML formats used by news sites, blogs, and podcasts. Converting an RSS feed to JSON makes it easy to process feed items with JavaScript or Python without adding an XML parser dependency to your project.
Parsing SOAP web service responses
Legacy enterprise systems and payment gateways often return SOAP XML responses. Converting the response to JSON lets you inspect the data structure immediately in a browser console or JSON viewer without writing XSLT or SAX parser code.
Converting Android resource files and configuration XML
Android layout files, Maven POM files, and Spring configuration XML can be converted to JSON for analysis, documentation, or migration to newer formats. The @ prefix attribute convention preserves all metadata without key collisions.
Processing SVG files as JSON data
SVG is an XML-based vector format. Converting an SVG to JSON lets you programmatically inspect or transform shape data, attributes, and path coordinates using standard JSON tools and libraries.
FAQ's
By default, attributes are stored with an @ prefix — so <book id="1"> produces {"@id": "1", ...}. You can choose Merge to place them without prefix, or Ignore to discard them entirely.
When two or more sibling elements share the same tag name, they are automatically collected into a JSON array. Two <item> elements become "item": [{...}, {...}].
The converter uses each element's local name without the namespace prefix as the JSON key. Namespace declarations (xmlns attributes) are treated as regular attributes and appear with the @ prefix unless attribute handling is set to Ignore.
Minify removes all whitespace and indentation from the JSON output, producing a compact single-line string useful for API payloads, database storage, or URL parameters where file size matters.
The tool shows the browser's XML parser error message. Common issues include unclosed tags, missing root element, unescaped special characters (& must be &, < must be <), and invalid XML declarations. Use the XML Formatter to identify and fix issues before converting.
Yes. Paste the full RSS XML — including the <?xml> declaration and <rss> root element — into the input panel. The parser handles the nested channel and item elements correctly, converting repeated items into a JSON array.
No. The entire conversion runs in your browser using the native DOMParser API. Your XML never leaves your device and is never stored or transmitted to any external server.