XML to JSON Converter
Convert XML to JSON instantly online. Free XML to JSON converter with attribute support, nested elements, and proper array detection. No signup required.
Related Tools
JSON → YAML
Convert JSON to YAML format instantly. Supports nested objects, arrays, and complex structures.
YAML → JSON
Convert YAML to JSON format instantly. Supports multi-document YAML and complex configurations.
CSV → JSON
Convert CSV to JSON array instantly. Automatic header detection and type inference.
XML (Extensible Markup Language) was the dominant data interchange format throughout the 1990s and 2000s, used in SOAP web services, RSS/Atom feeds, Android resource files, Maven POM files, SVG graphics, and Office Open XML documents. JSON replaced it for most new APIs, but vast quantities of legacy systems, enterprise middleware, and configuration formats still produce XML output.
Converting XML to JSON is necessary when a modern JavaScript or Python application needs to consume a legacy SOAP service, process an RSS feed, parse a Maven or Gradle build file, or ingest data exported from enterprise systems like SAP, Salesforce, or Oracle. The structural mismatch between XML's attribute/element duality and JSON's key-value model requires careful mapping decisions.
This tool uses the browser's built-in DOMParser to parse XML into a DOM tree, then recursively converts nodes to JSON — prefixing XML attribute names with @ to distinguish them from child elements, and collapsing repeated sibling tags into arrays. The result is pretty-printed JSON you can copy directly.
Common Use Cases
Consuming legacy SOAP API responses
Older enterprise systems (SAP, Oracle EBS, legacy banking APIs) expose data via SOAP, which wraps payloads in XML envelopes. A Node.js or browser app that needs to display this data can paste the XML response here to understand the JSON structure before writing a production XML-to-JSON parsing step.
Processing RSS and Atom feed data
RSS 2.0 and Atom feeds used by news aggregators and podcast platforms are XML documents. A developer building a custom feed reader or content aggregator can paste a feed here to map the XML item structure to JSON before writing the fetch + parse pipeline that populates their application's data store.
Parsing Android resource and manifest files
Android AndroidManifest.xml and res/values/strings.xml files define app configuration and UI strings. When scripting build automation or extracting app metadata in a CI pipeline, converting these XML files to JSON makes the data trivially queryable with jq or a JavaScript object path expression.
Extracting Maven POM dependency data
Maven pom.xml files list project dependencies in XML. Security scanning tools and custom dependency auditing scripts often need this data as JSON. Converting a POM file here produces a JSON structure that can be filtered with jq to extract all dependency blocks and their version constraints.
How to Use the XML to JSON Converter
- Paste your XML in the left panel.
- The JSON output appears automatically as you type.
- Click "Copy Output" to copy the JSON to your clipboard.
- Use "Load Example" to see a sample XML bookstore document.
- Click "Download" to save the result as a
.jsonfile.
Conversion Rules
- XML attributes are prefixed with
@(e.g.,@id,@lang). - Text content is returned as a plain string if the element has no attributes or children.
- Repeated sibling elements with the same tag name become a JSON array.
- Mixed content (attributes + text) uses a
#textkey for the text value.