XML to JSON

Parse XML documents into JSON, in your browser. Attributes are preserved with the @_ prefix.

Runs in your browser Instant No signup, no tracking

About this tool

XML remains common in enterprise APIs (SOAP, RSS, Atom, financial feeds). This converter maps each element to a JSON key and each attribute to a `@_`-prefixed sibling key, which is the fast-xml-parser convention. Repeated child elements become arrays. Text content of leaf elements is coerced to numbers or booleans where possible. Everything runs client-side.

Example

Paste the input on the left and you will get output like this:

Sample XML

<catalog>
  <book id="1">
    <title>The Pragmatic Programmer</title>
    <author>Hunt</author>
    <year>1999</year>
  </book>
  <book id="2">
    <title>Refactoring</title>
    <author>Fowler</author>
    <year>1999</year>
  </book>
</catalog>

Resulting JSON

{
  "catalog": {
    "book": [
      {
        "title": "The Pragmatic Programmer",
        "author": "Hunt",
        "year": 1999,
        "@_id": 1
      },
      {
        "title": "Refactoring",
        "author": "Fowler",
        "year": 1999,
        "@_id": 2
      }
    ]
  }
}

How to use XML to JSON

  1. Paste or type your XML into the left pane.
  2. The JSON appears instantly in the right pane. Conversion runs in your browser — nothing is uploaded.
  3. Copy the result to your clipboard or download it as a file.

FAQ

How are XML attributes represented?
Attributes appear as sibling keys with an @_ prefix, e.g. `<user id="1">` becomes `{ "user": { "@_id": 1 } }`.
Do namespaces work?
Namespaces are kept as part of the element name (e.g. `soap:Envelope`). They aren't parsed into a structured namespace map.
What about CDATA sections?
CDATA contents are read as their inner text, which is usually what you want for downstream JSON consumers.