I am running into an extremely stupid and infuriating issue.
I am getting a string from my server which I try to parse with Papa.parse to no avail.
If I print this string to the console by calling it and then copy/pasting that string into Papa.parse, it does work.
Code :
// this does not work
Papa.parse(res.result, {header: true, skipEmptyLines: true});
You can see that the \n
in the string are not interpreted as linebreak so Papa thinks all values are fields.
res.result
//copy-paste the string printed in the console
a = "the_string_I_just_copied"
Papa.parse(a)
Seems like something happens when I print it in the console because the line return characters are interpreted as line returns but I don't know what to do with that information.
res.result
contains the sequence \\n
, otherwise your log wouldn't print \n
as readable characters, but really just as a new line:
console.log( "hello\nworld" );
console.log( "hello\\nworld" );
This sequence doesn't represent the new line character, and thus it's only normal your parser doesn't recognize it as a row delimiter.
You need to fix your data.