cd .. (all tools)

XML ↔ JSON

Convert between XML and JSON.

// Runs in your browser. Nothing you type here is sent anywhere.

Direction

Attributes become "@name", text next to them "#text", and elements with the same name an array. Comments are dropped.

Indent the result with

Result

{
  "order": {
    "@id": "1042",
    "customer": {
      "name": "Ada Lovelace"
    },
    "line": [
      {
        "@sku": "A-1",
        "@quantity": "2",
        "price": {
          "@currency": "EUR",
          "#text": "4.50"
        }
      },
      {
        "@sku": "B-7",
        "@quantity": "1",
        "price": {
          "@currency": "EUR",
          "#text": "9.95"
        }
      }
    ],
    "paid": "true",
    "note": null
  }
}