Forum Discussion

deepak_shaw's avatar
deepak_shaw
Contributor
5 years ago

JSON parse error with string has new line characters

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

2 Replies

  • bojanvelevski's avatar
    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

  • Hi,

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