tRestClient Parsing JSON with multiple loop elements

tRestClient Parsing JSON with multiple loop elements

Hi,
I am using TOS 6.1.1 to call a Rest API to extract a JSON response. This response has multiple loop elements and is output within the string field from the tRestRequest
In the response there are three arrays, Order, Item & Payment. I need to parse this response and generate an xml file which iterates on the multiple Item nodes (Payment is not needed for now), but also being grouped on the ESPOrderNo field.
The number of item nodes is an unknown.
I have tried using tExtractJSONField component both looping on OutgoingOrders.Order (this created one order in the xml, but with one item record) and "OutgoingOrders.Order.OrderItems.Item" (this created one xml file per item)
Please can some advise be given on how to parse JSON where there are multiple loop elements that need to be handled.
The output JSON is:
{
  "responseStatus": "OK",
  "responseMessage": null,
  "timestamp": "2017-03-06T13:51:41+0000",
  "OutgoingOrders": {
    "Order":
        },
        "CurrencyCode": "",
        "CourierProfileName": "",
        "OrderItems": {
          "Item":
        },
        "BuyerId": "",
        "OrderStatus": "",
        "CourierName": "",
        "CourierService": "",
        "CourierServiceCode": "",
        "FulfilmentType": ""
      }
    ]
  },
  "PaginationResult": {
    "TotalNumberOfPages": 1,
    "TotalNumberOfEntries": 1
  }
}
Community Manager

Re: tRestClient Parsing JSON with multiple loop elements

Hi 
Using multiple tExtractJsonField components to parse each loop element, join the records back if needed. eg:
tRestClient--main--treplicate--main--tExtractJsonField1....
                                         -main--tExtractJsonField2....
                                        -main--tExtractJsonField1....
Regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business

Re: tRestClient Parsing JSON with multiple loop elements

Hi Shong,
Thank you for getting back to me.
What is the best method to join up the multiple tExtractJSONFields?
I have tried using tMap, tXMLMap, tJoin and tWriteXMLField but I am only able to join one of the tExtractJSONFields to these components.
Thanks 
Kieran