0

I'm trying to parse xml file which comes from FileUpload as a request and convert and return as json, but i always get this json object:

{
    "@attributes": {
        "schemaLocation": "urn:oasis:names:specification:ubl:schema:xsd:Invoice-2 UBL-Invoice-2.1.xsd"
    }
}

Here is the json file:

<?xml version="1.0" encoding="utf-8"?>
<Invoice
    xmlns:ubltr="urn:oasis:names:specification:ubl:schema:xsd:TurkishCustomizationExtensionComponents"
    xmlns:cctc="urn:un:unece:uncefact:documentation:2"
    xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
    xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
    xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2"
    xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2"
    xmlns:xades="http://uri.etsi.org/01903/v1.3.2#"
    xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" schemaLocation="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2 UBL-Invoice-2.1.xsd"
    xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2">
    <ext:UBLExtensions>
        <ext:UBLExtension>
            <ext:ExtensionContent />
        </ext:UBLExtension>
    </ext:UBLExtensions>
    <cbc:UBLVersionID>2.1</cbc:UBLVersionID>
    <cbc:CustomizationID>TR1.2</cbc:CustomizationID>
    <cbc:ProfileID>IHRACAT</cbc:ProfileID>
    <cbc:ID>UNI2022000001948</cbc:ID>
    <cbc:CopyIndicator>false</cbc:CopyIndicator>
    <cbc:UUID>1122c98e-f17b-48bc-a917-3694972d45a3</cbc:UUID>
    <cbc:IssueDate>2022-11-09</cbc:IssueDate>
    <cbc:IssueTime>11:55:47.0000000+03:00</cbc:IssueTime>
    <cbc:InvoiceTypeCode>ISTISNA</cbc:InvoiceTypeCode>
    <cbc:Note>1920442.28</cbc:Note>
    <cbc:Note>0.00</cbc:Note>
    <cbc:Note>1920442.28</cbc:Note>
    <cbc:Note>1920442.28</cbc:Note>
    <cbc:Note>TOPLAM : 4106 ADET / 215 KOLİ  </cbc:Note>
    <cbc:Note>Mallar TÜRK Menşelidir. </cbc:Note>
    <cbc:Note />
    <cbc:Note>İmalatçı :ÜNLÜ TEKSTİL SAN. VE TİC. A.Ş. </cbc:Note>
    <cbc:Note>İmalatçı  Adresi :Emek Mah. Sıvat Cad. No:15 Sancaktepe / İSTANBUL </cbc:Note>
    <cbc:Note>İmalatçı  Vergi No :9150249785 </cbc:Note>
    <cbc:Note>İmalatçı  Vergi Dairesi : ÇAMLICA İHTİSAS </cbc:Note>
    <cbc:Note>Kur : 21,2773 GBP / TRY,  Fatura Toplamı : 90.257,80 GBP</cbc:Note>
    <cbc:Note>Yalnız, DoksanBinİkiYüzElliYedi GBP.Seksen Cent'dir. </cbc:Note>
    <cbc:Note>Vergi İstisna Muafiyet Sebebi : 301-11/1-a Mal İhracatı</cbc:Note>
    <cbc:DocumentCurrencyCode>GBP</cbc:DocumentCurrencyCode>
    <cbc:PricingCurrencyCode>GBP</cbc:PricingCurrencyCode>
    <cbc:LineCountNumeric>5</cbc:LineCountNumeric>
    <cac:AdditionalDocumentReference>
        <cbc:ID>00000000-0000-0000-0000-000000000000</cbc:ID>
        <cbc:IssueDate>2022-11-09</cbc:IssueDate>
        <cbc:DocumentType>XSLT</cbc:DocumentType>
    </cac:AdditionalDocumentReference>
    <cac:Signature>
        <cbc:ID schemeID="VKN_TCKN">9130300454</cbc:ID>
        <cac:SignatoryParty>
            <cac:PartyIdentification>
                <cbc:ID schemeID="VKN">9130300454</cbc:ID>
            </cac:PartyIdentification>
            <cac:PostalAddress>
                <cbc:StreetName>EMEK MH. SIVAT CD NO:17</cbc:StreetName>
                <cbc:BuildingName>SARIGAZİ</cbc:BuildingName>
                <cbc:BuildingNumber>17</cbc:BuildingNumber>
                <cbc:CitySubdivisionName>Sancaktepe</cbc:CitySubdivisionName>
                <cbc:CityName>İstanbul </cbc:CityName>
                <cbc:PostalZone>34785</cbc:PostalZone>
                <cac:Country>
                    <cbc:Name>TR</cbc:Name>
                </cac:Country>
            </cac:PostalAddress>
        </cac:SignatoryParty>
        <cac:DigitalSignatureAttachment>
            <cac:ExternalReference>
                <cbc:URI>#Signature_UNI2022000001948</cbc:URI>
            </cac:ExternalReference>
        </cac:DigitalSignatureAttachment>
    </cac:Signature>
    <cac:AccountingSupplierParty>
        <cac:Party>
            <cbc:WebsiteURI>www.unlu.com</cbc:WebsiteURI>
            <cac:PartyIdentification>
                <cbc:ID schemeID="VKN">9130300454</cbc:ID>
            </cac:PartyIdentification>
            <cac:PartyIdentification>
                <cbc:ID schemeID="MERSISNO">0913030045400010</cbc:ID>
            </cac:PartyIdentification>
            <cac:PartyIdentification>
                <cbc:ID schemeID="TICARETSICILNO">692371</cbc:ID>
            </cac:PartyIdentification>
            <cac:PartyName>
                <cbc:Name>ÜNL DIŞ TİCARET LTD. ŞTİ. </cbc:Name>
            </cac:PartyName>
            <cac:PostalAddress>
                <cbc:StreetName>EMEK MH. SIVAT CD NO:17</cbc:StreetName>
                <cbc:BuildingName>SARIGAZİ</cbc:BuildingName>
                <cbc:BuildingNumber>17</cbc:BuildingNumber>
                <cbc:CitySubdivisionName>Sancaktepe</cbc:CitySubdivisionName>
                <cbc:CityName>İstanbul </cbc:CityName>
                <cbc:PostalZone>34785</cbc:PostalZone>
                <cac:Country>
                    <cbc:Name>TR</cbc:Name>
                </cac:Country>
            </cac:PostalAddress>
            <cac:PartyTaxScheme>
                <cac:TaxScheme>
                    <cbc:Name>SULTANBEYLİ</cbc:Name>
                </cac:TaxScheme>
            </cac:PartyTaxScheme>
            <cac:Contact>
                <cbc:Telephone>2166456900</cbc:Telephone>
                <cbc:Telefax>2164155467</cbc:Telefax>
                <cbc:ElectronicMail>serkan.atmis@unlu.com</cbc:ElectronicMail>
            </cac:Contact>
        </cac:Party>
    </cac:AccountingSupplierParty>
    <cac:AccountingCustomerParty>
        <cac:Party>
            <cac:PartyIdentification>
                <cbc:ID schemeID="VKN">1460415308</cbc:ID>
            </cac:PartyIdentification>
            <cac:PartyName>
                <cbc:Name>Gümrük ve Ticaret Bakanlığı</cbc:Name>
            </cac:PartyName>
            <cac:PostalAddress>
                <cbc:StreetName>Üniversiteler Mahallesi Dumlupınar Bulvarı</cbc:StreetName>
                <cbc:BuildingNumber>151</cbc:BuildingNumber>
                <cbc:CitySubdivisionName>Çankaya</cbc:CitySubdivisionName>
                <cbc:CityName>Ankara</cbc:CityName>
                <cac:Country>
                    <cbc:IdentificationCode>TR</cbc:IdentificationCode>
                    <cbc:Name>Türkiye</cbc:Name>
                </cac:Country>
            </cac:PostalAddress>
            <cac:PartyTaxScheme>
                <cac:TaxScheme>
                    <cbc:Name>Ulus</cbc:Name>
                </cac:TaxScheme>
            </cac:PartyTaxScheme>
        </cac:Party>
    </cac:AccountingCustomerParty>
    <cac:BuyerCustomerParty>
        <cac:Party>
            <cac:PartyIdentification>
                <cbc:ID schemeID="PARTYTYPE">EXPORT</cbc:ID>
            </cac:PartyIdentification>
            <cac:PartyName>
                <cbc:Name>JP BODEN &amp; CO LTD.</cbc:Name>
            </cac:PartyName>
            <cac:PostalAddress>
                <cbc:StreetName>114-120 VICTORIA ROAD, LONDON,</cbc:StreetName>
                <cbc:BuildingName />
                <cbc:CitySubdivisionName>6 NY</cbc:CitySubdivisionName>
                <cbc:CityName>NW10 </cbc:CityName>
                <cac:Country>
                    <cbc:IdentificationCode>GB</cbc:IdentificationCode>
                    <cbc:Name>İngiltere (Birleşik Krallık) </cbc:Name>
                </cac:Country>
            </cac:PostalAddress>
            <cac:PartyTaxScheme>
                <cac:TaxScheme>
                    <cbc:Name />
                </cac:TaxScheme>
            </cac:PartyTaxScheme>
            <cac:PartyLegalEntity>
                <cbc:RegistrationName>JP BODEN &amp; CO LTD.</cbc:RegistrationName>
                <cbc:CompanyID>1111111111</cbc:CompanyID>
            </cac:PartyLegalEntity>
            <cac:Contact />
        </cac:Party>
    </cac:BuyerCustomerParty>
    <cac:SellerSupplierParty>
        <cac:Party>
            <cac:PartyIdentification>
                <cbc:ID schemeID="PARTYTYPE">EXPORT</cbc:ID>
            </cac:PartyIdentification>
            <cac:PartyName>
                <cbc:Name>JP BODEN &amp; CO LTD.</cbc:Name>
            </cac:PartyName>
            <cac:PostalAddress>
                <cbc:Room>İNGİLTERE - LE3 8DU</cbc:Room>
                <cbc:StreetName>Boden Central ,Kirby Road Glenfield , LE3 8DU</cbc:StreetName>
                <cbc:BuildingName>Leicester</cbc:BuildingName>
                <cbc:CitySubdivisionName>LE19</cbc:CitySubdivisionName>
                <cbc:CityName>NW10 </cbc:CityName>
                <cac:Country>
                    <cbc:IdentificationCode>GB</cbc:IdentificationCode>
                    <cbc:Name>İngiltere (Birleşik Krallık) </cbc:Name>
                </cac:Country>
            </cac:PostalAddress>
            <cac:PartyTaxScheme>
                <cac:TaxScheme>
                    <cbc:Name />
                </cac:TaxScheme>
            </cac:PartyTaxScheme>
            <cac:PartyLegalEntity>
                <cbc:RegistrationName>JP BODEN &amp; CO LTD.</cbc:RegistrationName>
                <cbc:CompanyID>1111111111</cbc:CompanyID>
            </cac:PartyLegalEntity>
            <cac:Contact />
        </cac:Party>
    </cac:SellerSupplierParty>
    <cac:PaymentMeans>
        <cbc:PaymentMeansCode>1</cbc:PaymentMeansCode>
        <cbc:PaymentDueDate>2022-11-09</cbc:PaymentDueDate>
    </cac:PaymentMeans>
    <cac:PaymentTerms>
        <cbc:Note>DIGER – Mal Mukabili</cbc:Note>
    </cac:PaymentTerms>
    <cac:PricingExchangeRate>
        <cbc:SourceCurrencyCode>GBP</cbc:SourceCurrencyCode>
        <cbc:TargetCurrencyCode>GBP</cbc:TargetCurrencyCode>
        <cbc:CalculationRate>21.2773</cbc:CalculationRate>
        <cbc:Date>2022-11-09</cbc:Date>
    </cac:PricingExchangeRate>
    <cac:TaxTotal>
        <cbc:TaxAmount currencyID="GBP">0.00</cbc:TaxAmount>
        <cac:TaxSubtotal>
            <cbc:TaxableAmount currencyID="GBP">90257.80</cbc:TaxableAmount>
            <cbc:TaxAmount currencyID="GBP">0.00</cbc:TaxAmount>
            <cbc:Percent>0.00</cbc:Percent>
            <cac:TaxCategory>
                <cbc:TaxExemptionReasonCode>301</cbc:TaxExemptionReasonCode>
                <cbc:TaxExemptionReason>11/1-a Mal İhracatı</cbc:TaxExemptionReason>
                <cac:TaxScheme>
                    <cbc:Name>KDV</cbc:Name>
                    <cbc:TaxTypeCode>0015</cbc:TaxTypeCode>
                </cac:TaxScheme>
            </cac:TaxCategory>
        </cac:TaxSubtotal>
    </cac:TaxTotal>
    <cac:LegalMonetaryTotal>
        <cbc:LineExtensionAmount currencyID="GBP">90257.80</cbc:LineExtensionAmount>
        <cbc:TaxExclusiveAmount currencyID="GBP">90257.80</cbc:TaxExclusiveAmount>
        <cbc:TaxInclusiveAmount currencyID="GBP">90257.80</cbc:TaxInclusiveAmount>
        <cbc:AllowanceTotalAmount currencyID="GBP">0.00</cbc:AllowanceTotalAmount>
        <cbc:ChargeTotalAmount currencyID="GBP">0.00</cbc:ChargeTotalAmount>
        <cbc:PayableAmount currencyID="GBP">90257.80</cbc:PayableAmount>
    </cac:LegalMonetaryTotal>
    <cac:InvoiceLine>
        <cbc:ID>1</cbc:ID>
        <cbc:Note>"%92 VİSKON %8 ELASTAN BOYALI DOKUMA BAYAN PANTOLON (ASTARLI )</cbc:Note>
        <cbc:InvoicedQuantity unitCode="C62">1304.00000000</cbc:InvoicedQuantity>
        <cbc:LineExtensionAmount currencyID="GBP">28427.20</cbc:LineExtensionAmount>
        <cac:Delivery>
            <cac:DeliveryAddress>
                <cbc:Room>İNGİLTERE - LE3 8DU</cbc:Room>
                <cbc:StreetName>Boden Central ,Kirby Road Glenfield , LE3 8DU</cbc:StreetName>
                <cbc:BuildingName>Leicester</cbc:BuildingName>
                <cbc:CitySubdivisionName>LE19</cbc:CitySubdivisionName>
                <cbc:CityName>NW10 </cbc:CityName>
                <cac:Country>
                    <cbc:IdentificationCode>GB</cbc:IdentificationCode>
                    <cbc:Name>İngiltere (Birleşik Krallık) </cbc:Name>
                </cac:Country>
            </cac:DeliveryAddress>
            <cac:DeliveryTerms>
                <cbc:ID schemeID="INCOTERMS">FCA</cbc:ID>
            </cac:DeliveryTerms>
            <cac:Shipment>
                <cbc:ID>1</cbc:ID>
                <cac:GoodsItem>
                    <cbc:RequiredCustomsID>620469180000</cbc:RequiredCustomsID>
                </cac:GoodsItem>
                <cac:ShipmentStage>
                    <cbc:TransportModeCode>3</cbc:TransportModeCode>
                </cac:ShipmentStage>
                <cac:TransportHandlingUnit>
                    <cac:ActualPackage />
                </cac:TransportHandlingUnit>
            </cac:Shipment>
        </cac:Delivery>
        <cac:Item>
            <cbc:Name>PANTOLON</cbc:Name>
            <cbc:ModelName>600.10.006</cbc:ModelName>
        </cac:Item>
        <cac:Price>
            <cbc:PriceAmount currencyID="GBP">21.80000000</cbc:PriceAmount>
        </cac:Price>
    </cac:InvoiceLine>
    <cac:InvoiceLine>
        <cbc:ID>2</cbc:ID>
        <cbc:Note>"%92 VİSKON %8 ELASTAN BOYALI DOKUMA BAYAN PANTOLON (ASTARLI )</cbc:Note>
        <cbc:InvoicedQuantity unitCode="C62">873.00000000</cbc:InvoicedQuantity>
        <cbc:LineExtensionAmount currencyID="GBP">19031.40</cbc:LineExtensionAmount>
        <cac:Delivery>
            <cac:DeliveryAddress>
                <cbc:Room>İNGİLTERE - LE3 8DU</cbc:Room>
                <cbc:StreetName>Boden Central ,Kirby Road Glenfield , LE3 8DU</cbc:StreetName>
                <cbc:BuildingName>Leicester</cbc:BuildingName>
                <cbc:CitySubdivisionName>LE19</cbc:CitySubdivisionName>
                <cbc:CityName>NW10 </cbc:CityName>
                <cac:Country>
                    <cbc:IdentificationCode>GB</cbc:IdentificationCode>
                    <cbc:Name>İngiltere (Birleşik Krallık) </cbc:Name>
                </cac:Country>
            </cac:DeliveryAddress>
            <cac:DeliveryTerms>
                <cbc:ID schemeID="INCOTERMS">FCA</cbc:ID>
            </cac:DeliveryTerms>
            <cac:Shipment>
                <cbc:ID>2</cbc:ID>
                <cac:GoodsItem>
                    <cbc:RequiredCustomsID>620469180000</cbc:RequiredCustomsID>
                </cac:GoodsItem>
                <cac:ShipmentStage>
                    <cbc:TransportModeCode>3</cbc:TransportModeCode>
                </cac:ShipmentStage>
                <cac:TransportHandlingUnit>
                    <cac:ActualPackage />
                </cac:TransportHandlingUnit>
            </cac:Shipment>
        </cac:Delivery>
        <cac:Item>
            <cbc:Name>PANTOLON</cbc:Name>
            <cbc:ModelName>600.10.006</cbc:ModelName>
        </cac:Item>
        <cac:Price>
            <cbc:PriceAmount currencyID="GBP">21.80000000</cbc:PriceAmount>
        </cac:Price>
    </cac:InvoiceLine>
    <cac:InvoiceLine>
        <cbc:ID>3</cbc:ID>
        <cbc:Note>"%92 VİSKON %8 ELASTAN BOYALI DOKUMA BAYAN PANTOLON (ASTARLI )</cbc:Note>
        <cbc:InvoicedQuantity unitCode="C62">747.00000000</cbc:InvoicedQuantity>
        <cbc:LineExtensionAmount currencyID="GBP">17031.60</cbc:LineExtensionAmount>
        <cac:Delivery>
            <cac:DeliveryAddress>
                <cbc:Room>İNGİLTERE - LE3 8DU</cbc:Room>
                <cbc:StreetName>Boden Central ,Kirby Road Glenfield , LE3 8DU</cbc:StreetName>
                <cbc:BuildingName>Leicester</cbc:BuildingName>
                <cbc:CitySubdivisionName>LE19</cbc:CitySubdivisionName>
                <cbc:CityName>NW10 </cbc:CityName>
                <cac:Country>
                    <cbc:IdentificationCode>GB</cbc:IdentificationCode>
                    <cbc:Name>İngiltere (Birleşik Krallık) </cbc:Name>
                </cac:Country>
            </cac:DeliveryAddress>
            <cac:DeliveryTerms>
                <cbc:ID schemeID="INCOTERMS">FCA</cbc:ID>
            </cac:DeliveryTerms>
            <cac:Shipment>
                <cbc:ID>3</cbc:ID>
                <cac:GoodsItem>
                    <cbc:RequiredCustomsID>620469180000</cbc:RequiredCustomsID>
                </cac:GoodsItem>
                <cac:ShipmentStage>
                    <cbc:TransportModeCode>3</cbc:TransportModeCode>
                </cac:ShipmentStage>
                <cac:TransportHandlingUnit>
                    <cac:ActualPackage />
                </cac:TransportHandlingUnit>
            </cac:Shipment>
        </cac:Delivery>
        <cac:Item>
            <cbc:Name>PANTOLON</cbc:Name>
            <cbc:ModelName>600.10.006</cbc:ModelName>
        </cac:Item>
        <cac:Price>
            <cbc:PriceAmount currencyID="GBP">22.80000000</cbc:PriceAmount>
        </cac:Price>
    </cac:InvoiceLine>
    <cac:InvoiceLine>
        <cbc:ID>4</cbc:ID>
        <cbc:Note>"%92 VİSKON %8 ELASTAN BOYALI DOKUMA BAYAN PANTOLON (ASTARLI )</cbc:Note>
        <cbc:InvoicedQuantity unitCode="C62">613.00000000</cbc:InvoicedQuantity>
        <cbc:LineExtensionAmount currencyID="GBP">13363.40</cbc:LineExtensionAmount>
        <cac:Delivery>
            <cac:DeliveryAddress>
                <cbc:Room>İNGİLTERE - LE3 8DU</cbc:Room>
                <cbc:StreetName>Boden Central ,Kirby Road Glenfield , LE3 8DU</cbc:StreetName>
                <cbc:BuildingName>Leicester</cbc:BuildingName>
                <cbc:CitySubdivisionName>LE19</cbc:CitySubdivisionName>
                <cbc:CityName>NW10 </cbc:CityName>
                <cac:Country>
                    <cbc:IdentificationCode>GB</cbc:IdentificationCode>
                    <cbc:Name>İngiltere (Birleşik Krallık) </cbc:Name>
                </cac:Country>
            </cac:DeliveryAddress>
            <cac:DeliveryTerms>
                <cbc:ID schemeID="INCOTERMS">FCA</cbc:ID>
            </cac:DeliveryTerms>
            <cac:Shipment>
                <cbc:ID>4</cbc:ID>
                <cac:GoodsItem>
                    <cbc:RequiredCustomsID>620469180000</cbc:RequiredCustomsID>
                </cac:GoodsItem>
                <cac:ShipmentStage>
                    <cbc:TransportModeCode>3</cbc:TransportModeCode>
                </cac:ShipmentStage>
                <cac:TransportHandlingUnit>
                    <cac:ActualPackage />
                </cac:TransportHandlingUnit>
            </cac:Shipment>
        </cac:Delivery>
        <cac:Item>
            <cbc:Name>PANTOLON</cbc:Name>
            <cbc:ModelName>600.10.006</cbc:ModelName>
        </cac:Item>
        <cac:Price>
            <cbc:PriceAmount currencyID="GBP">21.80000000</cbc:PriceAmount>
        </cac:Price>
    </cac:InvoiceLine>
    <cac:InvoiceLine>
        <cbc:ID>5</cbc:ID>
        <cbc:Note>"%92 VİSKON %8 ELASTAN BOYALI DOKUMA BAYAN PANTOLON (ASTARLI )</cbc:Note>
        <cbc:InvoicedQuantity unitCode="C62">569.00000000</cbc:InvoicedQuantity>
        <cbc:LineExtensionAmount currencyID="GBP">12404.20</cbc:LineExtensionAmount>
        <cac:Delivery>
            <cac:DeliveryAddress>
                <cbc:Room>İNGİLTERE - LE3 8DU</cbc:Room>
                <cbc:StreetName>Boden Central ,Kirby Road Glenfield , LE3 8DU</cbc:StreetName>
                <cbc:BuildingName>Leicester</cbc:BuildingName>
                <cbc:CitySubdivisionName>LE19</cbc:CitySubdivisionName>
                <cbc:CityName>NW10 </cbc:CityName>
                <cac:Country>
                    <cbc:IdentificationCode>GB</cbc:IdentificationCode>
                    <cbc:Name>İngiltere (Birleşik Krallık) </cbc:Name>
                </cac:Country>
            </cac:DeliveryAddress>
            <cac:DeliveryTerms>
                <cbc:ID schemeID="INCOTERMS">FCA</cbc:ID>
            </cac:DeliveryTerms>
            <cac:Shipment>
                <cbc:ID>5</cbc:ID>
                <cac:GoodsItem>
                    <cbc:RequiredCustomsID>620469180000</cbc:RequiredCustomsID>
                </cac:GoodsItem>
                <cac:ShipmentStage>
                    <cbc:TransportModeCode>3</cbc:TransportModeCode>
                </cac:ShipmentStage>
                <cac:TransportHandlingUnit>
                    <cac:ActualPackage />
                </cac:TransportHandlingUnit>
            </cac:Shipment>
        </cac:Delivery>
        <cac:Item>
            <cbc:Name>PANTOLON</cbc:Name>
            <cbc:ModelName>600.10.006</cbc:ModelName>
        </cac:Item>
        <cac:Price>
            <cbc:PriceAmount currencyID="GBP">21.80000000</cbc:PriceAmount>
        </cac:Price>
    </cac:InvoiceLine>
</Invoice>

and here is the Controller code:

 public function getXml(Request $request) 
    {
        $file = $request->file('xmlfile');
        
        $xmlObject = simplexml_load_string($file->get());
        $json = json_encode($xmlObject);
        $phpArray = json_decode($json, true);
        

        return response()->json($phpArray);
    }

What is wrong, i couldn't find it.

mehmetserif
  • 1,185
  • 7
  • 26
  • 48
  • there is a simplexml_load_file function, no need to retrieve the file. – Lk77 Dec 23 '22 at 16:07
  • First of all, it's not a JSON file, it's an XML file. Have you looked at https://stackoverflow.com/questions/27634240/xml-to-json-conversion-in-php-simplexml ? – Dmitry K. Dec 23 '22 at 16:13

0 Answers0