Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I'm posting a form to an ASP.Net MVC action that returns a JSON object. This object is received, parsed and bound correctly. So I know the service is working correctly and the data is understandable.

The issue is that I have a string that may contain line breaks /r that are getting removed at some point.

This is the JSON coming into the browser captured in Chrome's network->response tab.

   "PropertyModel":{"Id":6131,"Ref":"61267","Address":"16\rSpringfield Green\rHunslet","PostCode":"LS10 2EJ  "}

However in my view these aren't rendered. Regardless of whether I wrap it in a <pre> or use white-space:pre;

How do i go about getting my /n back!?

share|improve this question
    
I think you need to escape the codes in the JSON: \\r. –  Andy Sep 1 '14 at 10:08
    
Have you got any code that you can show us, so we can see what you are trying to do? –  Martin Folkeseth Sep 1 '14 at 12:23
    
I'm not doing any processing of the returned data. Just assigning it to a scope var then binding to it using curly braces in the view. It's not going through any filters or anything. –  Ben Ford Sep 1 '14 at 12:30
    
See this answer - stackoverflow.com/questions/5916340/… Use \n or \r\n rather than just \r. –  Sacho Sep 1 '14 at 13:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.