DevConvert
Free Online Tool

XML to JSON Converter

Convert XML to JSON instantly online. Paste any XML document and get clean, structured JSON. Free XML to JSON converter — handles attributes, namespaces, and nested elements.

Try sample:
Input
Output

Output will appear here

Press ⌘ Enter to convert

How It Works

  1. 1Paste your XML document
  2. 2DevConvert parses elements, text nodes, and attributes
  3. 3Get a structured JSON object — copy or download the output

Examples

Simple element

Input

<user><id>1</id><name>Alice</name><active>true</active></user>

Output

{
  "user": {
    "id": "1",
    "name": "Alice",
    "active": "true"
  }
}
With attributes

Input

<product id="P001" category="electronics"><name>Laptop</name><price>59999</price></product>

Output

{
  "product": {
    "@id": "P001",
    "@category": "electronics",
    "name": "Laptop",
    "price": "59999"
  }
}
API SOAP-style response

Input

<response><status>success</status><data><count>42</count></data></response>

Output

{
  "response": {
    "status": "success",
    "data": { "count": "42" }
  }
}

Frequently Asked Questions

How are XML attributes handled in JSON?

XML element attributes are prefixed with @ in the resulting JSON object, e.g. <book id="1"> becomes { "@id": "1" }.

Does this handle XML namespaces?

Namespace prefixes are preserved as-is in the JSON keys. Namespace declarations (xmlns:) are treated as attributes.

What about CDATA sections?

CDATA content is extracted and treated as the text value of the element, same as regular text nodes.

Can I convert SOAP responses?

Yes. Paste the full SOAP envelope XML and DevConvert will parse the nested structure into a JSON object you can inspect.

Related Tools