Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
BeginnerNeedsHelpPlease

json fiel : question about twritejsonfield tFileoutputjson, and a loop element

Hello

I need to work with jon file.

I just understood what's json file : for me it's like a dictionnary in Python.

I have to create a json file from a tabular data: it can have one line or many lines.

I'm not sure when I have to use twritejsonfield or tFileoutputjson.

Also, I'm confused with a loop element. can you explain it? I s it related to an array which is in the json file?

thank you

Labels (2)
1 Reply
anselmopeixoto
Partner - Creator III
Partner - Creator III

Hello @adi nul​ 

 

Indeed it is similar to dictionaries in Python, and with json you have the ability to have repeating elements, that might look like another dictionary or array inside a parent dictionary element. That is achieved using loop.

 

A loop element would look like phoneNumbers on the example below.

 

{

   "firstName": "John",

   "lastName": "doe",

   "age": 26,

   "address": {

       "streetAddress": "naist street",

       "city": "Nara",

       "postalCode": "630-0192"

   },

   "phoneNumbers": [

       {

           "type": "iPhone",

           "number": "0123-4567-8888"

       },

       {

           "type": "home",

           "number": "0123-4567-8910"

       }

   ]

}

 

For an example on the official documentation, please take a look at this link: https://help.talend.com/r/en-US/8.0/processing/processing-other

 

Now about tWriteJsonField and tFileOutputJson: basically the first allows you to create a whole json content inside a schema column and the last one is meant to write the json content to a file.