title: Make WebAPI reject unknown fields when binding JSON to a model
body: <p>In ASP .NET WebAPI, consider the following simple model class:</p>
  
  <pre><code>public class Model {
      public string Value { get; set; }
  }
  </code></pre>
  
  <p>If I have a controller method that takes this as a parameter:</p>
  
  <pre><code>[HttpPut]
  public HttpResponseMessage PutModel(Model data)
  {
      if (!ModelState.IsValid)
          return Request.CreateResponse(HttpStatusCode.BadRequest);
  
      // more code ...
  }
  </code></pre>
  
  <p>and I pass in <code>{ "unknown": "value" }</code> as the request body, the model binder will gleefully succeed, completely ignoring the unknown field. This is not very acceptable for future-proofing, since we want to reserve all possible field values and error out if they are provided rather than just silently fail, allowing someone to shoot themselves in the foot later on.</p>
  
  <p>How do I make the model binding error on unknown fields?</p>