Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

json to xml

I have a requirement to extract data from RestAPI and convert it to xml format. The problem comes from how to handle data that is looped

The data comes in the body

ex. json

{
  "magentoOrderId": "200026689",
  "comments": null,
  "date": "2020-04-27 15:50:55",
  "zone": 1,
  "customer": {
    "magentoCustomerId": "3633",
    "email": "emparbadia@icloud.com",
    "phoneNo": "615272461",
    "name": "Empar Badia Nácher",
    "shipToCountry": "ES",
    "shipToCity": "Swedish",
    "shipToPostCode": "46410",
    "shipToAddress": "C / dels Foressos, 27, 1",
    "shipToAddress2": null,
    "billToCountry": "ES",
    "billToPostCode": "46410",
    "billToCity": "Swedish",
    "billToAddress": "C / dels Foressos, 27, 1",
    "billToAddress2": "Valencia"
  },
  "salesLines": [
    {
      "itemId": "11000135242",
      "unitPrice": "66.0300",
      "discountPct": "0.0000",
      "quantity": "1.0000"
    },
    {
      "itemId": "11000326942",
      "unitPrice": "66.0400",
      "discountPct": "0.0000",
      "quantity": "1.0000"
    }
  ],
  "paymentMethodCode": "i4redsyspro",
  "shippingCost": "0.0000"
}

salesLines has a loop, how do I fix it to pass to xml

At the moment I have the following

tRestRequest -> TextractJSONFields

Thank you

Labels (2)
1 Reply
manodwhb
Champion II
Champion II

If your are using enterprise Talend, then you can use tHmap to convert Json to XML.