Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Lorenzo5
Creator
Creator

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

 

 

 

 

Labels (3)
5 Replies
Anonymous
Not applicable

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
Lorenzo5
Creator
Creator
Author

Hi @shong

 

have you followed link I provided?

As you can see in the page linked, "firstname" is set as loop-element, and when you scroll down the page and take a look to the json result, firstname is definitely not a loop element (it is a string element, instead).

So, it is still not clear the purpose of defining firstname as loop-element when it is not.

root
Creator II
Creator II

Hi, is there any documentation on how to set an element as "group"? I am seeing that option grayed out all the time. 

fab_74
Contributor III
Contributor III

hi,

the loop element must be the finest level
If your json has a flat structure you do not have the group function.
to activate this last one it is necessary to create a node in which you can make a loop.
You can thus have the function group element

 

 


json1.PNG
twritejson.PNG
Anonymous
Not applicable