title: return Json error from ASP.NET MVC
body: <p>I'm trying to return an error message via Json from ASP.NET MVC controller. I want to display carriage returns on the screen, so the error will look like:</p>
  
  <blockquote>
    <p>Error 1.<br />
    Error 2.</p>
  </blockquote>
  
  <p>instead of <code>"Error1.\u003cbr/\u003eErro2.\u003cbr.\u003e"</code></p>
  
  <p>Here's my ASP.NET MVC code</p>
  
  <pre><code>Response.StatusCode = (int)HttpStatusCode.BadRequest;
  string str = "Error 1.&lt;br/&gt;Error 2.&lt;br.&gt;";
  return Json(str);
  </code></pre>
  
  <p>JavaScript (redacted):</p>
  
  <pre><code>.ajax({...
       error: function(xhr, textStatus, exceptionThrown) {
          $('#result').html(xhr.responseText);
       },
  </code></pre>
  
  <p>Debugging the xhr.responseText yields: <code>""Error1.\u003cbr/\u003eErro2.\u003cbr.\u003e""</code></p>
  
  <p>Any ideas?</p>