Creating JSON target with multiple loops

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.

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.
Highlighted
One Star

Re: Creating JSON target with multiple loops

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

Regards,
Smith

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Downloads and Trials

Test drive Talend's enterprise products.

Downloads