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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
DM_J
Contributor II
Contributor II

fail to parse the json file error

I am getting an error when I parse a JSON file from a list of JSON files, I used these two documents:

  1. for iterating throughout the directory -> Scenario 1: Iterating on a file directory from https://help.talend.com/r/mjoDghHoMPI0yuyZ83a13Q/Tx8GE09IR2ERGP4GqSsY2w
  2. for the parsing JSON files: Scenario 1: Extracting JSON data from a file using JSONPath without setting a loop node from https://help.talend.com/r/X0AUAzvEDYaq6vqZaP5AYQ/no26uqebEdJX8yyxlNvlUw

Here is the part of the JSON file:

0693p00000C8C70AAF.png 

I am parsing id, name, firstName, middleName, lastName, gender, initialRegistrationDate, expirationRegistrationDate, and commonName. Note that they are on the first layer of the JSON so they don't have a header.0693p00000C8BzfAAF.png0693p00000C8C04AAF.png

Labels (4)
5 Replies
MS5
Contributor III
Contributor III

Hello,

Issue appears for all JSON file you tested or only for one particular cases?

All output columns in your tFileInputJSON are in String?

Can you please provide logs of you execution ?

DM_J
Contributor II
Contributor II
Author

Does the issue appear for all JSON files you tested or only for one particular case? All cases

All output columns in your tFileInputJSON are in String? Yes

Can you please provide logs of your execution?0693p00000C8EULAA3.png execution?

 

MS5
Contributor III
Contributor III

Thank you.

It seems that the issue is not on how you describe the json file in Talend, but the json file itself.

I've created the same job as you.

It work with the file attached :

0693p00000C8Et6AAF.pngDo you see anything different in your json file?

If I add a } at the end (which is not correct), I receive the same error as in your log : fail to parse the json file

DM_J
Contributor II
Contributor II
Author

I thought about it before and I did the same test and I got the same result, but I did another extra test:

  • I chose 4 random files from the files I use as the input and checked them with a JSON validation tool like https://jsonformatter.curiousconcept.com/ and they passed
  • I created metadata for them in Talend, then I used tFileIputRaw and tFileOutputraw and saved one file again when I validated the new file it didn't pass, it seems the job changes something like adding a space

 

I attached a pic with two of them at the same time, below is the file after running the job it shows maybe there is a space before the bracket, and up is the original file. when I compare two files with tools like diffchecker they show these two files are the same as each other, so I am really confused here! as these tools show even one file has extra space with the other.0693p00000C8LcvAAF.png

MS5
Contributor III
Contributor III

Is your file encoding in UTF8 BOM?

Talend have issues to work with encoding with BOM, and it can also explain the result you obtain with your second job.