Commonly I ask simple questions, but this is definitely something rather complex.
Is there a method in KNIME to read and process JSONL files?
Have a great weekend!
Commonly I ask simple questions, but this is definitely something rather complex.
Is there a method in KNIME to read and process JSONL files?
Have a great weekend!
Hi @DmitryIvanov76 ,
I haven’t seen any JSONL specific nodes, and I hadn’t previously looked at the JSON Lines format. However, having found examples on the internet, I had a play.
So I have a plain .json file that looks like this:
and this is as you doubtless will already know is readable using the standard JSON Reader.
This same file, in JSONL format, I think looks like this (I found it in somewhere on the internet, saying it was jsonl format so hopefully that’s correct):
After experimenting, this is what I found:
JSON Reader works for the JSON file, but not the JSONL file
As far as I can see, JSONL files are designed to be processed one line at a time, and so actually the Line Reader combined with JSON nodes seems to do the required job.
For the JSONL file, attaching it to a Line Reader and then converting to JSON seems to be a valid mechanism:
Does this work for you?
KNIME_read_json_lines_file.knwf (134.3 KB)
Thank you very much for the advice!
I will test proposed solution later today.
I was also thinking about reading the file line by line, but forgot about “Line Reader” (tried common File reader node and failed, I had some minor achivements with CSV Reader, but in fact it doesn’t work).
I will revert with update.
Thanks again!
I tested the workflow which you proposed - it works perfect! Thank you very much - I hope one day I will be half as good with KNIME as you !
Have a nice day!
Hi @DmitryIvanov76, thank you for your kind words and for confirming the solution. Hope you have a good day too.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.