Avatar

Community Advisor

Hi @ujjyals87155580,

take care of escaping special characters.

You may call a following function to escape text before putting it in JSON:

 

String.prototype.escapeSpecialCharacters = function() {
return this.replace(/\\n/g, "\\n")
.replace(/\\'/g, "\\'")
.replace(/\\"/g, '\\"')
.replace(/\\&/g, "\\&")
.replace(/\\r/g, "\\r")
.replace(/\\t/g, "\\t")
.replace(/\\b/g, "\\b")
.replace(/\\f/g, "\\f");
}; 

 

Regards,

Milan