Bidirectional • Client-Side Parser 100% Client-Side

XML to JSON Converter

Transform XML markup with attributes, namespaces, and CDATA into structured JSON (or JSON back to XML) client-side.

JSON Output
{
  "catalog": {
    "@store": "EU-West",
    "product": [
      {
        "@id": "SKU-401",
        "@inStock": true,
        "name": "Wireless Mechanical Keyboard",
        "price": {
          "@currency": "EUR",
          "#text": 119.5
        },
        "tags": {
          "tag": [
            "hardware",
            "bluetooth"
          ]
        }
      },
      {
        "@id": "SKU-402",
        "@inStock": false,
        "name": "USB-C NVMe Enclosure",
        "price": {
          "@currency": "EUR",
          "#text": 34.9
        }
      }
    ]
  }
}
10 elements · 7 attributes · depth 4Open JSON Formatter →

XML to JSON Serialization Rules: Attributes, Arrays, and Mixed Text

Enterprise integrations often bridge legacy XML APIs—such as SOAP envelopes, RSS/Atom feeds, SAML assertions, and XSD sitemaps—with modern REST services built around JSON. Because XML supports tag attributes and mixed content nodes that have no direct native JSON equivalent, consistent mapping conventions keep round-trip conversions lossless.

XML PatternMapped JSON OutputBehavior
<price currency="EUR">19.99</price>{ "@currency": "EUR", "#text": 19.99 }Preserves attributes alongside element text
<tag>a</tag><tag>b</tag>"tag": ["a", "b"]Sibling tags merge into ordered array
<empty />"empty": nullSelf-closing empty tags convert cleanly to null

Frequently Asked Questions

Clear, concise answers to common questions about Base64 decoding, encoding, and specifications.

By default, attributes on XML elements (such as id="104" or currency="USD") are mapped to keys prefixed with @ (for example, "@id": 104). You can customize the attribute prefix, switch to underscore _, or omit attributes completely.