I have a JSON file and i am getting the json content which may contain new lines in it. Now i am facing a problem. I am getting the below error :
Unexpected token ↵ in JSON at position 9
Note: the error message says specificaly this symbol: '↵'. What does this mean?
My JSON:
{"T":".
^00:00:43^2008-09-11 12:00:00.0"}
But if i remove the new line (not sure if its a new line or a tab space no matter what i am facing this issue even if its a tab space or new line. It works fine with normal space.). Below is the modified JSON and it looks good.
Modified JSON:
{"T":".^00:00:43^2008-09-11 12:00:00.0"}
I have tried to follow similar threads like here and here and some similar threads. but nothing works even after applying those. Any help is appreciated here please.
This is one the solution i have tried:
var jsonString = JSON.stringify(data).replace(/(\r\n|\n|\r)/gm,"");
Is there anyway to detect these linebreaks and tab spaces and remove them?