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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
HVasa1630039830
Contributor
Contributor

How to convert json object to json array with twriteJsonField Component tried with attribute as array but not working

Hi All,

As iam new to talend i started few ways to achieve the below output could you please guide me on the same :

my twriteJsonfield component is generating the response as follow:

{

"tranid": "1212",

"user": {

"name": "123",

"addr": "786 rt"

},

"loc": {

"lction": "123",

"state": "ind"

}

}

but need the ouput json as follow :

{

"tranid": "1212",

"user": [{

"name": "123",

"addr": "786 rt"

}],

"loc": [{

"lction": "123",

"state": "ind"

}]

}

eventhough the user attribute has single pair of values in the response i want them to be of type array (surrounded with square brackets)

i know that twritejson field component will convert the same to array in case if we have more values , but in my case even though their is single value it should be surrounded with square brackets ([])

Could you please guide me on the same ??

my job flow :

tdbinput --> tmap --> twritejsonfield (want to include square brackets for single objects too )--> kafkaout

Labels (5)
0 Replies