XML to JSON Library Comparison

Example XML tXml tXml Simplified xml-js xml-js Compact fast-xml-parser w/o ignoreAttributes xml2js

fast-xml-parser w/o ignoreAttributes

{
  "?xml": {
    "@_version": "1.0"
  },
  "?xml-stylesheet": {
    "@_href": "catalog.xsl",
    "@_type": "text/xsl"
  },
  "catalog": {
    "product": {
      "catalog_item": [
        {
          "item_number": "QWZ5671",
          "price": 39.95,
          "size": [
            {
              "color_swatch": [
                {
                  "#text": "Red",
                  "@_image": "red_cardigan.jpg"
                },
                {
                  "#text": "Burgundy",
                  "@_image": "burgundy_cardigan.jpg"
                }
              ],
              "@_description": "Medium"
            },
            {
              "color_swatch": [
                {
                  "#text": "Red",
                  "@_image": "red_cardigan.jpg"
                },
                {
                  "#text": "Burgundy",
                  "@_image": "burgundy_cardigan.jpg"
                }
              ],
              "@_description": "Large"
            }
          ],
          "@_gender": "Men's"
        },
        {
          "item_number": "RRX9856",
          "price": 42.5,
          "size": [
            {
              "color_swatch": [
                {
                  "#text": "Red",
                  "@_image": "red_cardigan.jpg"
                },
                {
                  "#text": "Navy",
                  "@_image": "navy_cardigan.jpg"
                },
                {
                  "#text": "Burgundy",
                  "@_image": "burgundy_cardigan.jpg"
                }
              ],
              "@_description": "Small"
            },
            {
              "color_swatch": [
                {
                  "#text": "Red",
                  "@_image": "red_cardigan.jpg"
                },
                {
                  "#text": "Navy",
                  "@_image": "navy_cardigan.jpg"
                },
                {
                  "#text": "Burgundy",
                  "@_image": "burgundy_cardigan.jpg"
                },
                {
                  "#text": "Black",
                  "@_image": "black_cardigan.jpg"
                }
              ],
              "@_description": "Medium"
            },
            {
              "color_swatch": [
                {
                  "#text": "Navy",
                  "@_image": "navy_cardigan.jpg"
                },
                {
                  "#text": "Black",
                  "@_image": "black_cardigan.jpg"
                }
              ],
              "@_description": "Large"
            },
            {
              "color_swatch": [
                {
                  "#text": "Burgundy",
                  "@_image": "burgundy_cardigan.jpg"
                },
                {
                  "#text": "Black",
                  "@_image": "black_cardigan.jpg"
                }
              ],
              "@_description": "Extra Large"
            }
          ],
          "@_gender": "Women's"
        }
      ],
      "@_description": "Cardigan Sweater",
      "@_product_image": "cardigan.jpg"
    }
  }
}