How to escape a JSON string containing newline characters using JavaScript?

I have to form a JSON string in which a value is having new line character. This has to be escaped and then posted using AJAX call. Can any one suggest a way to escape the string with JavaScript. I am not using jQuery.

17 Answers
17

Leave a Comment