title: return JSON string from MVC controller
body: <p>I use the following code to send/receive an object to my mvc controller:</p>
  
  <pre><code>$.ajax({
  url: _createOrUpdateTimeRecord,
  data: JSON.stringify(data),
  type: "POST",
  //dataType: "json",
  contentType: "application/json; charset=utf-8",
  beforeSend: function () {
      $("#loading-overlay").show();
  },
  success: function (data2) {
      try {   // tried to parse it manually to see if anything changes.
          data2 = JSON.parse(data2);
      }
      catch (err) {
  
      }
  },
  error: function (xhr, ajaxOptions, thrownError) {
      alert(thrownError + 'xhr error -- ' + xhr.status);
  }
  </code></pre>
  
  <p>});</p>
  
  <p>On my mvc controller I have my JSON object as string so I don't need the .NET JavascriptSerializer and JsonResult.</p>
  
  <p>My JSON string looks like:</p>
  
  <pre><code>data2 = "{title:'1111111',start:'2014-03-23T16:00:00.000',end:'2014-03-23T18:00:00.000',id:107,hdtid:1,color:'#c732bd',allDay:false,description:''}"
  </code></pre>
  
  <p>And I always get:
  "Invalid character"</p>
  
  <p>I already tried to return a string and parse the JSON manually on client side. Therefore I used ContentResult as return type but with no success</p>
  
  <pre><code>    public class JsonStringResult : ContentResult
      {
          public JsonStringResult(string json)
          {
              Content = json;
              ContentType = "application/json";
          }
      }
  </code></pre>
  
  <p>What is the problem here? The JSON looks fine...</p>
  
  <p>Cheers,
  Stefan</p>