Replace \n with <br> in JSON string
Try this.
stringData = stringData.replace(new RegExp("\\\\n", "g"), "<br />");
or this
stringData = stringData.replace(/\\n/g, "<br />");
based on comments and building on other answer..
var json = JSON.parse(stringData);json.body = body = json.body.replace(/\n/g, "<br />");// and then if you needed it in a string you can do this againstringData = JSON.stringify(json);