title: How to set default json serialization settings for HttpClient (WinForms)
body: <p>I have a WinForms app that uses a Web API back-end and I want all the HTTP requests / responses to use specific json SerializerSettings.  On the server-side, this is easy by just doing this in Global.asax.cs:</p>
  
  <pre><code>GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.DateParseHandling = DateParseHandling.None;
  GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb);
  </code></pre>
  
  <p>On the client-side, I tried this:</p>
  
  <pre><code>JsonConvert.DefaultSettings = () =&gt; new JsonSerializerSettings
  {
      Formatting = Formatting.Indented,
      ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
      DateParseHandling = DateParseHandling.None
  }.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb);
  </code></pre>
  
  <p>This works when I use JsonConvert explicitly, e.g.:</p>
  
  <pre><code>var someVm = JsonConvert.DeserializeObject&lt;SomeVm&gt;(jsonString);
  </code></pre>
  
  <p>However, it does not take effect for calls using HttpClient.GetAsync / PostAsAsync, etc.  resulting in an exception:</p>
  
  <blockquote>
    <p>Error converting value 2/24/2018 4:00:00 PM to type
    'System.Nullable<code>1[NodaTime.LocalDateTime]'. Path
    'folderExpectedDate', line 16, position 45.
    Newtonsoft.Json.JsonSerializationException: Error converting value
    2/24/2018 4:00:00 PM to type
    'System.Nullable</code>1[NodaTime.LocalDateTime]'. Path
    'folderExpectedDate', line 16, position 45. --->
    System.ArgumentException: Could not cast or convert from
    System.DateTime to NodaTime.LocalDateTime.</p>
  </blockquote>
  
  <p>Note, the exact same JSON that causes the exception above works fine when calling DeserializeObject as above.</p>
  
  <p><strong>How can I set / modify the default serialization settings used by HttpClient</strong> (I do not want to specify it in every call - there are several hundreds of them)?</p>