I have a JSON string for example:
"\nReferenceNo:20,Amount:100\nReferenceNo:30,Amount:200"
now i want to replace \n with <br /> HTML tag. My code is given below
var myJSONString = JSON.stringify(d.otherDetails);
result=myJSONString.replace(RegExp("\n","g"), "<br />");
alert(result);
How to do that?
Thanks in advance
\r\n). Where are you trying to display it? In the browser?