title: JsonConvert.SerializeObject adds \r\n
body: <p>so currently I am working on a WebAPI and I run in the following error.</p>
  
  <p>While I try to return a List serialized with JsonConvert.SerializeObject(object) my second attribute (string JSON) get covered up by carriage returns and line feeds.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>public class Template
  {
      public string Name;
      public string JSON;
  }
      public HttpResponseMessage GetAll()
      {
          var items = db.GetTemplates().ToList&lt;Template&gt;();
  
  
          var resp = new HttpResponseMessage()
          {
              Content = new StringContent(JsonConvert.SerializeObject(items),Encoding.UTF8,"application/json")
          };
          resp.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
  
          return resp;
  
      }
  </code></pre>
  
  <p>Changing to:</p>
  
  <pre><code>Content = new StringContent(JsonConvert.SerializeObject(items.ToList&lt;Template&gt;()[0]),Encoding.UTF8,"application/json")
  </code></pre>
  
  <p>Shows the same error</p>
  
  <p>While changing the code to:</p>
  
  <pre><code>Content = new StringContent(JsonConvert.SerializeObject(items.ToList&lt;Template&gt;()[0].JSON),Encoding.UTF8,"application/json")
  </code></pre>
  
  <p>Everything returns fine...</p>
  
  <p>Checked in Browser, not in Visual Studio!</p>
  
  <p>Anyone got a hint for me? Google just won't let me find the answer.</p>
  
  <p>Thanks in Advance!</p>