XML to JSON Converter

Convert XML data to JSON format. Customize attribute prefix and text key name. Elements with the same tag name are automatically converted to arrays. Everything runs in your browser.

What is XML to JSON?

XML to JSON is a tool that converts XML data to JSON (JavaScript Object Notation) format. XML attributes are represented as '@attributeName' keys, and text nodes as '#text' keys. Multiple child elements with the same tag name are automatically converted to arrays. Empty elements become null, and CDATA sections are preserved as '#cdata' keys. The attribute prefix and text key name are customizable.

How to Use

  1. Paste your XML into the left text area
  2. Optionally change the attribute prefix and text key name
  3. Click 'Convert to JSON' button

Usage Examples

Input:
<user id="1">
  <name>Alice</name>
  <tags><tag>admin</tag><tag>active</tag></tags>
</user>
JSON output:
{
  "user": {
    "@id": "1",
    "name": "Alice",
    "tags": { "tag": ["admin", "active"] }
  }
}
Practical use: Convert a SOAP API XML response to JSON for easier handling in JavaScript

FAQ

How are attributes converted?
By default, they are represented as '@attributeName' keys. The attribute prefix is customizable.
What happens when there are multiple child elements with the same name?
They are automatically converted to arrays. A single element is stored as a direct value.
How are empty elements converted?
They are converted to null.
Are CDATA sections preserved?
Yes. They are preserved as the '#cdata' key.
Is my data sent to a server?
No. All processing happens entirely in your browser. Sensitive data is safe.

Related Tools

Update History

Last Updated: 2026-02-19

  • 2026-02-19 Initial release