Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a job where I am trying to transform a csv input file to create a json output to file.
The csv file contains string values as well as integer values. However it produces all values as string (between quotes) even when the data types are not string i.e. integer value 123456789 as "123456789".
My job has the following components
tFileInputDelimited >>tMap>>tWriteJSONField>>tLogRow>>tFileOutputDelimited
Is there a simple way of doing this?
@ThirupathiReddy is using tFileOutputJSON rather than tWriteJSONField. Here is the documentation for tWriteJSONField:
https://help.talend.com/reader/wDRBNUuxk629sNcI0dNYaA/ZXYb2NIVoiib7B8sYGRVJQ
The section on Configuring a JSON Tree addresses your issue specifically.
Input and tFileOutputJson components is enough for this task.
in tFileOutputJson component if we have int as datatype then we will get with out quotes for integer values.
See attached screenshots.
Thanks but what I am trying to do is take in a csv file and transform it into a json file.
I have an example below...
This is the sample file
In the tMap the person_id is converted from string to an integer
However when I execute my job it writes out person_id value as a string (see log output below)
Is there a way to solve this?
@ThirupathiReddy is using tFileOutputJSON rather than tWriteJSONField. Here is the documentation for tWriteJSONField:
https://help.talend.com/reader/wDRBNUuxk629sNcI0dNYaA/ZXYb2NIVoiib7B8sYGRVJQ
The section on Configuring a JSON Tree addresses your issue specifically.
Thanks but it does not produce the json in the format that I need.
I have created a work-around by building the json as variables in a tMap and concatenating the variables together and writing to a file with .json extension, this does the trick for me.
Hello,
I have created a work-around by building the json as variables in a tMap and concatenating the variables together and writing to a file with .json extension, this does the trick for me.
Would you mind posting your work around and solution on forum?
Best regards
Sabrina