--- title: "convert XML to JSON()" slug: "basic-xml-to-json" updated: 2025-11-12T13:55:51Z published: 2025-11-14T02:46:31Z canonical: "docs.lobstersoftware.com/basic-xml-to-json" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.lobstersoftware.com/llms.txt > Use this file to discover all available pages before exploring further. # convert XML to JSON() Diese Funktion wandelt den Text einer XML-Datei oder ein XML-DOM-Objekt in den Text einer JSON-Datei um. ## Parameter | Parameter | Beschreibung | | --- | --- | | a | Der Text einer XML-Datei oder der Name eines XML-DOM-Objekts, siehe Funktion [parse XML()](/v1/docs/xml-parse-xml). Siehe auch Parameter **b**. | | b | (optional) *true*, falls in Parameter **a** ein XML-DOM-Objekt angegeben wurde. Default: *false*. | | c | (optional) *true*, um den JSON-Text zu formatieren (pretty format). Default: *false*. | ## Beispiel Gegeben sei folgende XML-Datei. ```xml article@pos 1 article@pos 2 ``` Daraus wird folgende JSON-Datei. ```json {   "Order":{      "date":"today",      "line":[         {            "product":{               "pos":"1",               "ean":"0815",               "amount":"2.0",               "vat":"19%",               "net":"100",               "description":"article@pos 1"            }         },         {            "product":{               "pos":"2",               "ean":"4711",               "amount":"1.0",               "vat":"19%",               "net":"145.34",               "description":"article@pos 2"            }         }      ],      "footer":{         "totalSum":"345.34",         "Text":"end of order"      }   } } ```