Six Stars

tWriteJSONField: why "Set As Loop Element"?

Looking at this scenario:

https://help.talend.com/reader/wDRBNUuxk629sNcI0dNYaA/oNb3uOB_7iXYY0w_dH3W2A

I read, at a certain point:

9. Right-click firstname and select Set As Loop Element from the context menu.

 

Well, the result is a "plain" json, without any loop element:

{"field1":"111","field2":"222","field3":"333"}

{"field1":"444","field2":"555","field3":"666"}

Why on earth field1 should be a "Loop Element"?

 

Thanks for your clarification,

Lorenzo

 

 

 

 

  • Data Integration
1 REPLY
Community Manager

Re: tWriteJSONField: why "Set As Loop Element"?

Hello
To write a XML or Json field, you have to set a loop element. If you want to generate only one string, you need to define the group element also, the output string looks like:
{"rootTag":{"users":[{"id":"1","name":"shong"},{"id":"2","name":"elise"},{"id":"3","name":"ross"}]}}

Regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business