XML to JSON to XML

Thanks for looking into this. I understand where you get confused. I shouldn’t have used FakturaWiersz. The FakturaWiersz is part of the original XML. See row 88 if you double click on the cell of the XML reader.

If I stick to the Faktura part, it should look like this for both invoices in the final XML (so two section of the below, both with an opening and closing tag tns:Faktura).

<tns:Faktura>
    <tns:KodWaluty>PLN</tns:KodWaluty>
    <tns:P_1>2025-06-03</tns:P_1>
    <tns:P_2A>2503600000311</tns:P_2A>
    <tns:P_3A>CUSTOMER_NAME_1</tns:P_3A>
    <tns:P_3B>CUSTOMER_ADDRESS_1</tns:P_3B>
    <tns:P_3C>SUPPLIER_NAME</tns:P_3C>
    <tns:P_3D>SUPPLIER_ADDRESS</tns:P_3D>
    <tns:P_4B>123456789</tns:P_4B>
    <tns:P_5A>PL</tns:P_5A>
    <tns:P_5B>987654321</tns:P_5B>
    <tns:P_6>2025-06-30</tns:P_6>
    <tns:P_13_1>699.43</tns:P_13_1>
    <tns:P_14_1>160.87</tns:P_14_1>
    <tns:P_15>860.3</tns:P_15>
    <tns:P_16>false</tns:P_16>
    <tns:P_17>false</tns:P_17>
    <tns:P_18>false</tns:P_18>
    <tns:P_18A>true</tns:P_18A>
    <tns:P_19>false</tns:P_19>
    <tns:P_20>false</tns:P_20>
    <tns:P_21>false</tns:P_21>
    <tns:P_22>false</tns:P_22>
    <tns:P_23>false</tns:P_23>
    <tns:P_106E_2>false</tns:P_106E_2>
    <tns:P_106E_3>false</tns:P_106E_3>
    <tns:RodzajFaktury>VAT</tns:RodzajFaktury>
</tns:Faktura>


I’m basically stuck after the UNGROUP node. I have all the data elements in a tabular structure so I can manipulate some data (but I’ll leave that out for now). But how do I create a parent child structure again?

I’ve adjusted my workflow (attached) to only have a few lines to make it simpler as you suggested (as the principle is the same). The result should look as follows:

<tns:Faktura>
    <tns:KodWaluty>PLN</tns:KodWaluty>
    <tns:P_1>2025-06-03</tns:P_1>
    <tns:P_2A>2503600000311</tns:P_2A>
    <tns:P_3A>CUSTOMER_NAME_1</tns:P_3A>
    <tns:P_3B>CUSTOMER_ADDRESS_1</tns:P_3B>
</tns:Faktura>
<tns:Faktura>
    <tns:KodWaluty>PLN</tns:KodWaluty>
    <tns:P_1>2025-06-03</tns:P_1>
    <tns:P_2A>2503600000312</tns:P_2A>
    <tns:P_3A>CUSTOMER_NAME_2</tns:P_3A>
    <tns:P_3B>CUSTOMER_ADDRESS_3</tns:P_3B>
</tns:Faktura>

Also the XML namespace (tns:) I’m struggling to add. Partly because in the final bigger XML there’s also other namespaces used. But let’s ignore that for now.

I hope this helps.

XML to JSON to XML JPK FA SIMPLIFIED.knwf (77.6 KB)