Sales Orders JSON to XML


Hi All,


I am working on a prototype to send Sales Order data from ERP system to on external system. The data flow should look like this


ERP --- API -- (JSON)--Logic App ---(XML)--SFTP/File Server


I am receiving Sales Orders with single header and multiple lines items. My Logic App is working fine but generating 1 XML per line item. I want one XML File with header and all lines. Any idea how how this scenario be achieved using Logic App?


Please see here my demo flow for transformation logic. I think it's For each that is generating multiple XML file for each line item in Order Payload. 









1 Reply
Yes, this is due to the for each loop. If you need a single output, remove the foreach and use xml() function from expressions(if it's a direct JSON to XML conversion). If the transformation is more complex, use inline code or liquid/xslt mapping.