
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
