cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

JSON parse error with string has new line characters

deepak_shaw
Contributor

Noticed some times I received JSON parse error when the string contains new line characters.

2 REPLIES 2

bojanvelevski
Valued Contributor

Hey @deepak.shaw,

You should escape the controll characters like new line. Try .replaceAll(โ€˜\nโ€™,โ€˜\nโ€™) on the JSON string, and than parse it.

Regards,

Bojan

deepak_shaw
Contributor

Hi,

Thanks for the replyโ€ฆ but suddenly it starts working, without doing any changes, it parses correctly with replacing any character.