Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello guys!
I have the following table structure and I'd like to create a JSON file using the tWriteJSONField.
FirstName | LastName
John | McCain
Peter | Fitzgerald
Pablo | De Los Santos
My JSON should be something like that below. The name of the nest could be created using the Numeric.sequence function I suppose.
{
"0" : {
"FirstName" : "John",
"LastName" : "McCain"
},
"1" : {
"FirstName" : "Peter",
"LastName" : "Fitzgerald"
},
"2" : {
"FirstName" : "Pablo",
"LastName" : "De Los Santos"
}
}
Thanks for helping me.
You can do such things - and more - with the component tJSONDocOutput. Get them in Talend Exchange or Github: https://github.com/jlolling (more up-to-date)
Hello
The element name must be defined before the job execution and it can't be a variable, so it is impossible to generate a json string like you showed with tWriteJsonField.
Regards
Shong
You can do such things - and more - with the component tJSONDocOutput. Get them in Talend Exchange or Github: https://github.com/jlolling (more up-to-date)
@lli wrote:
You can do such things - and more - with the component tJSONDocOutput. Get them in Talend Exchange or Github: https://github.com/jlolling (more up-to-date)
Thanks a milion!
This is still not very easy. The output component can use values as field names but the current version is not flexible enough to add per row one new attribute+object. I have in my current project a similar problem and will solve this by update the components in the next days.
I can currently create this:
[ {
"0" : {
"firstname" : "John",
"lastname" : "McCain"
}
}, {
"1" : {
"firstname" : "Peter",
"lastname" : "Fritzgerald"
}
}, {
"2" : {
"firstname" : "Pablo",
"lastname" : "De Los Santos"
}
} ]
I have solved the issue! In the next days I will test it if there is no unwanted impact to other parts and publish the new version.
There is no change within the configuration of a component.
{
"0" : {
"firstname" : "John",
"lastname" : "McCain"
},
"1" : {
"firstname" : "Peter",
"lastname" : "Fritzgerald"
},
"2" : {
"firstname" : "Pablo",
"lastname" : "De Los Santos"
}
}
HI @lli,
Thanks for the reply. I will take this as reference and try to complete and let you know.
Once again thanks for the quick response.
Thanks,
Bharath.
I have just published on Talend Exchange and Github the new version (14.0) of the tJSONDoc components which allows the described job design.