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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
aviralagl
Contributor
Contributor

Create a JSON file using features of native tWriteJSONField component - loop and group by

I have a joblet ouput with schema as below:

id
attr1
attr2
attrNext


I would like to create a JSON file that looks like below:

[ {
      "id":"100001",
      "attrMain":[
         {
            "attr1":"aa",
            "attr2":"abc@xyz.com"
         },
         {
            "attr1":"bb",
            "attr2":"pqr@abc.com"
         },
         {
            "attr1":"cc",
            "attr2":"xyz@xyz.com"
         },
      ]
   }
]

I have so far been using tWriteJSONField with a Group by over "id" & setting attrMain as the group element, and attr1 as loop element in the "Configure JSON Tree" editor. I would like to achieve the same using tJSONDoc* components. So far, I have been able to get the below output (screenshot of job attached):

 

[   {
  "id" : "100001",
  "attrMain" : [ {
    "attr1" : "aa"
  }, {
    "attr2" : "abc@xyz.com"
  } ]
}, {
  "id" : "100001",
  "attrMain" : [ {
    "attr1" : "bb"
  }, {
    "attr2" : "pqr@abc.com"
  } ]
}, {
  "id" : "100001",
  "attrMain" : [ {
    "attr1" : "cc"
  }, {
    "attr2" : "xyz@xyz.com"
  } ]
} ]

Any suggestions? Happy to provide more information on request!

Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable

Hello,

tJsonDocOutput is a custom component written by talend community user and shared on talend exchange portal.

We don't have the source code of these components.  It is the ownership of the person who built it. Feel free to contact the author directly.

Best regards

Sabrina

 

View solution in original post

1 Reply
Anonymous
Not applicable

Hello,

tJsonDocOutput is a custom component written by talend community user and shared on talend exchange portal.

We don't have the source code of these components.  It is the ownership of the person who built it. Feel free to contact the author directly.

Best regards

Sabrina