title: Web API ModelBinders - how to bind one property of your object differently
body: <p>I have the following action signature</p>
  
  <pre><code>    [ValidateInput(false)]
      public HttpResponseMessage PostParam(Param param)
  </code></pre>
  
  <p>With Param looking something like this:</p>
  
  <pre><code>public class Param {
    public int Id { get; set;}
    public string Name { get; set; }
    public string Choices { get; set; }
  }
  </code></pre>
  
  <p>Here's the hitch - what comes over the wire is something like this</p>
  
  <pre><code>{
    Id: 2,
    Name: "blah",
    Choices: [
      {
        foo: "bar"
      },
      {
        blah: "blo"
        something: 123
      }
    ]
  }
  </code></pre>
  
  <p>I don't want "Choices" to deserialize - I want it stored as a string (yes, I understand the security implications). Understandably, I get an error because since the default binder does not know this.</p>
  
  <p>Now with Asp Mvc creating a specific ModelBinder would be fairly simple. I'd </p>
  
  <ul>
  <li>inherit DefaultModelBinder</li>
  <li>override the property deserialization with my own</li>
  <li>set the binder in my <code>Application_Start</code> using <code>Binders.Add</code></li>
  </ul>
  
  <p>Seems like with Web Api this is a different process - the System.Web.DefaultModelBinder doesn't have anything to override and that I can't hook things up using <code>Binders.Add</code>.  I've tried looking around but couldn't find much on how to actually do what I want. This is further complicated since apparently the ModelBinders api changed quite a bit over Beta and RTM so there's a lot of outdated information out there.</p>