Creating JSON target with multiple loops

Highlighted
Six Stars

Creating JSON target with multiple loops

Hi,

can someone tell me how can i create json target with mutlple loops. I tried using twriteJSONField and tFileOutputJson. but they were allowing only one loop. but i need to apply 2 loops for my requirement.

 

below is the source:

orderno,lineitem,quantity,shipment
121568,1,5,C-1528
121568,2,3,C-1529


sample target:

{
"order_info" :{
  "orderno" : "121568",
  "line_items":[  {
  "lineitem": "1",
  "quantity" : "5"
  },
  {
   "lineitem": "2",
  "quantity": "3"
  }
  ],
  "shipments":[
    {
      "shipment_id" : "C-1528",
      "quantity" : "5"
    },{
      "shipment_id" : "C-1529",
      "quantity" : "3"
    }
    ]
}
}

 

Thanks in advance. Let me know if anything required.

Tags (2)
Moderator

Re: Creating JSON target with multiple loops

Hello,

It is impossible to create multiple loop elements with tWriteJsonField component. Right now, you can only generate a json file for each loop element.

Best regards

Sabrina

 

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: Creating JSON target with multiple loops

Is it possible to get on multiple loop like this way?

Regards,
Smith

Cloud Free Trial

Try Talend Cloud free for 30 days.

Tutorial

Introduction to Talend Open Studio for Data Integration.

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.