0

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!?

Ben Ford
  • 1,354
  • 2
  • 14
  • 35
  • I think you need to escape the codes in the JSON: `\\r`. – Andy Sep 01 '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 01 '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 01 '14 at 12:30
  • See this answer - http://stackoverflow.com/questions/5916340/using-only-cr-as-linebreak-inside-pre-tag-doesnt-work Use \n or \r\n rather than just \r. – Sacho Sep 01 '14 at 13:49

0 Answers0