title: Newtonsoft.Json not serializing object as expected - error 400
body: <p>I'm trying to send a post request with a json string of an object I have created. However after serializing my c# object and posting I get a 400 error (problems parsing JSON)</p>
  
  <p>I'm using the Newtonsoft.Json dll to serialize my object. Here is the object I am serializing:</p>
  
  <pre><code>public class CreateRepository
  {
      [JsonProperty("name")]
  
      public string Name { get; set; }
  
      [JsonProperty("description")]
  
      public string Description { get; set; }
  
      [JsonProperty("homepage")]
  
      public object Homepage { get; set; }
  
      [JsonProperty("gitignore_template")]
      public string GitIgnoreTemplate { get; set; }
  
      [JsonProperty("license_template")]
      public string LicenceTemplate { get; set; }
  
      [JsonProperty("private")]
  
      public bool Private { get; set; }
  
      [JsonProperty("has_projects")]
      public bool HasProjects { get; set; }
  
      [JsonProperty("has_issues")]
      public bool HasIssues { get; set; }
  
      [JsonProperty("has_template")]
      public bool HasTemplate { get; set; }
  
      [JsonProperty("has_wiki")]
      public bool HasWiki { get; set; }
  }
  </code></pre>
  
  <p>I am then serializing an instance of the object like so:</p>
  
  <pre><code>var content = JsonConvert.SerializeObject(repository);
  </code></pre>
  
  <p>This then generates the json string below:</p>
  
  <pre><code>{
      \"name\": \"Test\",
      \"description\":null,
      \"homepage\":null,
      \"gitignore_template\":null,
      \"license_template\":null,
      \"private\":false,
      \"has_projects\":false,
      \"has_issues\":false,
      \"has_template\":false,
      \"has_wiki\":false}
  }
  </code></pre>
  
  <p>I get the following back after attempting to post the request:</p>
  
  <pre><code>{
      "message": "Problems parsing JSON",
      "documentation_url": "https://developer.github.com/v3/repos/#create"
  }
  </code></pre>
  
  <p>Does anyone know why my object has been serialized in this way? </p>
  
  <p>Update:</p>
  
  <p>I can deserialize the object using JSON.Net without any errors.</p>
  
  <p>The url I'm posting to is as follows:</p>
  
  <pre><code>https://api.github.com/user/repos
  </code></pre>
  
  <p>this is how I'm sending the request:</p>
  
  <pre><code>var response = await _httpClient.PostAsJsonAsync("user/repos", content);
  </code></pre>