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

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
andre4598
Contributor II
Contributor II

How to create json output to file retaining non-string data types

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?    

Labels (4)
1 Solution

Accepted Solutions
cterenzi
Specialist
Specialist

@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.

View solution in original post

6 Replies
Anonymous
Not applicable

 

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.


json_1.PNG
output_Json.PNG
andre4598
Contributor II
Contributor II
Author

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
0683p000009LvFc.png

 

 

 

 

 

 

 

 

 

 

In the tMap the person_id is converted from string to an integer 0683p000009Lv4q.png

 

 

 

 

 

 

 

 

 

 

 

However when I execute my job it writes out person_id value as a string  (see log output below)0683p000009LvFm.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Is there a way to solve this?

cterenzi
Specialist
Specialist

@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.

andre4598
Contributor II
Contributor II
Author

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.

Anonymous
Not applicable

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

andre4598
Contributor II
Contributor II
Author

I revisited @cterenzi suggestion and have got my job working. 

 

0683p000009LvV6.png0683p000009LvVB.png

Thanks