Skip to content

XML to JSON Converter

Convert XML data to JSON format with support for attributes, nested elements, and arrays

Legacy XML Meets Modern JSON

You’re integrating with a SOAP API that returns XML. Or parsing an old RSS feed. Or converting an Android layout file to JSON for a migration tool. The modern web speaks JSON, and half the world’s existing data is still in XML. Someone’s got to convert it.

The browser’s built-in DOMParser handles the XML parsing. This tool recursively walks the parsed tree, converting elements to JSON objects, attributes to @-prefixed keys (so <book id="5"> becomes {"@id": "5"}), text content to values, and repeated same-name siblings to arrays automatically.

Conversion Example

<book id="1">
  <title>The Great Gatsby</title>
  <author>F. Scott Fitzgerald</author>
</book>

Becomes:

{
  "book": {
    "@id": "1",
    "title": "The Great Gatsby",
    "author": "F. Scott Fitzgerald"
  }
}

Three <item> elements inside a <list> automatically become a JSON array under the "item" key. The tool figures out when sibling elements should be grouped.

Where This Saves Hours

SOAP API migration. You’re replacing a SOAP backend with a REST API. Convert sample SOAP responses to JSON to design your new response format and write the mapping layer.

RSS/Atom feed processing. You want to display feed entries in a React component. Convert the XML feed to JSON and work with it natively in JavaScript.

Android to React Native migration. You’ve got XML layout files that define your UI. Converting them to JSON is the first step in translating the structure to JSX components.

Config format modernization. Old Java apps use XML config files. New Node.js services expect JSON. Convert the structure here and adjust the values.

Edge Cases

Namespace prefixes stay in the keys. <ns:element> becomes {"ns:element": ...}. Strip them in post-processing if you don’t need them.

CDATA sections become plain text. The CDATA wrapper is removed, and the content appears as a regular string value.

Mixed content (text + child elements) is tricky. The tool handles it, but the JSON structure might not be exactly what you expect. Review the output for elements that contain both text and child elements.

The JSON to XML converter goes the other direction. Both tools run in your browser using the built-in DOMParser. No data leaves the page.

xml json converter data transform

Related Tools

More in Data Tools