Help with json response

Hello guys

               `i am making a web service call and the returned json contains \\n instead \n so               how can i convert \\n to \n in angularjs`

Try with something like this:

var response = {'key': '\\n test\\n some test\\n new test'}; var newchar = '\\n'; var oldchar = '\n'; var replacedResponse = JSON.parse(JSON.stringify(response).split(',').join(newchar));

thanks buddy will try it and let you know

this approach is not working

          {"Title":"Haramukk","Date":"2016-05-04 00:00:00","Description":"Lyath wuchkha maen      \\n hehra lazmaya maaji hendis       guudis","User":"Ezaz","Place":"Srinagar","id":0,"Category":"Pyul","author":"Ezaz"}

     this is the console.log of the data i am receiving i want to convert \\n to \n in Description key 


I must be missing something here, but why do you feel the need to do this? \\n is what newlines look like in JSON, and JSON.parse should convert them into newlines in the resulting object properties. This shouldn’t be something you have to concern yourself with in application code.

i tried JSON.parse in the application code and browser

in browser it seems to be working while as in application code doesnt work

 var text = {"Title":"Haramukk","Date":"2016-05-04 00:00:00","Description":"Lyath wuchkha maen \\n hehra lazmaya maaji hendis guudis","User":"Ezaz","Place":"Srinagar","id":0,"Category":"Pyul","author":"Ezaz"};

  obj = JSON.parse(JSON.stringify(text));

This code works in browser but not in the application

@mhartington can you help me in this matter

i just want to add a filter to description key so that i can break it into paragraphs but this doesnt seem to be working

It works in browser but not in ionic app


 .filter('nl2p', function () {
return function(text){
    text = String(text).trim();
    return (text.length > 0 ? '<p>' + text.replace(/[\r\n]+/g, '</p><p>') + '</p>' : null);