Troubleshooting XML to JSON Conversion: Mapping the Parent Record for Proper Format

Scenario

When attempting to convert XML to JSON format using the map in the BizTalk send port, I encountered an issue. The output I received was not in the expected format. Please note that the XML format would be then converted to the corresponding JSON format by means of a JSON encoder.

Expected format

    <Order>
        <CustomerPO>1234</CustomerPO>
        <DeliveryDate>0610202312:00</DeliveryDate>
        <OrderSource>Sales Order</OrderSource>
        <LineItems>
            <LineItem>
                <ItemNumber>1111</ItemNumber>
                <OrderQuantity>2</OrderQuantity>
                <UnitOfMeasure>CASE</UnitOfMeasure>
                <UnitPrice>31.4</UnitPrice>
            </LineItem>
        </LineItems>
        <LineItems>
            <LineItem>
                <ItemNumber>1112</ItemNumber>
                <OrderQuantity>1</OrderQuantity>
                <UnitOfMeasure>CASE</UnitOfMeasure>
                <UnitPrice>80.61</UnitPrice>
            </LineItem>

Actual format

    <Order>
        <CustomerPO>1234</CustomerPO>
        <DeliveryDate>0610202312:00</DeliveryDate>
        <OrderSource>Sales order</OrderSource>
        <LineItems>
            <LineItem>
                <ItemNumber>1111</ItemNumber>
                <OrderQuantity>2</OrderQuantity>
                <UnitOfMeasure>CASE</UnitOfMeasure>
                <UnitPrice>31.4</UnitPrice>
            </LineItem>
            <LineItem>
                <ItemNumber>1112</ItemNumber>
                <OrderQuantity>1</OrderQuantity>
                <UnitOfMeasure>CASE</UnitOfMeasure>
                <UnitPrice>80.61</UnitPrice>
            </LineItem>


Solution

We need to map the parent record to fix the issue. These records are repeating and hence need to be mapped to make it repeat.





Comments

Popular posts from this blog

EDI X12 Trading partner configuration in BizTalk

How to create an EDI 850 profile in Boomi?

Basics of Correlation in BizTalk