title: How to use Json.NET as default deserializer in an ASP.NET MVC 3+ application?
body: <p>There're a lot of resources on how to substitute the Json.NET library as the <a href="https://stackoverflow.com/a/7150912/304588">default <strong>serializer</strong></a> in ASP.NET MVC apps, but, for the life of me, I can't find a single resource on how to set it as the default <strong>deserializer</strong>.</p>
  
  <p>To illustrate that a bit, here's some template code:</p>
  
  <pre><code>                              // how to use Json.NET when deserializing
                                // incoming arguments?
                                      V
  public ActionResult SomeAction ( Foo foo ) {
  
      // this piece of code has lots of resources
      // on how to override the default Javascript serializer
      return Json(new Bar());
  
  }
  </code></pre>
  
  <p>How do I tell my application to use Json.NET when deserializing incoming parameters in controller actions, say, from a jQuery AJAX call?</p>
  
  <pre><code>$.ajax({
      type : 'POST',
      data : { foo : 'bar' }
  });
  </code></pre>
  
  <p>I've tried adapting <code>MediaTypeFormatters</code> into my code by adjusting <a href="http://www.west-wind.com/weblog/posts/2012/Mar/09/Using-an-alternate-JSON-Serializer-in-ASPNET-Web-API" rel="nofollow noreferrer">this resource from Rick Strahl</a>, but that didn't work either. Note that I'm not in a WebAPI environment --- but I expect that one solution that works on a normal <code>Controller</code> should work (albeit with minimal adjustments) in an <code>ApiController</code>.</p>