I'm appending a Json records sequence in a text file using the 'File Node', and the last line is a newline character. After, I read this file with 'File In Node' and 'Json Node' to convert in Json. It works, but always return the error message 'Unexpected end of JSON input in Json Node' when the node reads the newline. Is there some solution to avoid this error?
I think that if you feed it through a function node containing this (which trims white space characters off the ends of the string) then it should be ok. Newlines count as white space characters. Feed it into the JSON node after the function node.
i agree .. msg per line .. and maybe a function node .. after the File in node that filters any \n or \r or "" empty lines before sending it to the Json node.
@bobfield Would it possible to post the text file ?
It works. I follows your recommenadtion, and added the 'node-red-contrib-filter' to my pallet. Then, before the Json Node, I filter the content file to records != (string with no filling).
A very easy way to get rid of the last line being read in is to add a switch node after the file is and use the 'is not empty' test. That way the last line will not pass on, but the others will.