title: Argument is null in call to .NET Web API GET method
body: <p>I have two similar Web API controllers, one working and one not.  Can't find why the broken one is not working.  What happens is all the fields of the input argument are null.   Here's the controller method signature:</p>
  
  <pre><code>public IEnumerable&lt;Product&gt; GetProducts([FromUri] StateQuery query)
  </code></pre>
  
  <p>Parameter type:</p>
  
  <pre><code>public class StateQuery
  {
      public State state;
      public string username;
      public string password;
  }
  </code></pre>
  
  <p>Routing:</p>
  
  <pre><code>config.MapHttpAttributeRoutes();
  
  config.Routes.MapHttpRoute(
              name: "Default",
              routeTemplate: "api/{controller}/{action}"
  );
  </code></pre>
  
  <p>Calling the endpoint:</p>
  
  <pre><code>var uri = 'api/product/';
  var query = {
                  username: $("#user").val(),
                  password: $("#password").val(),
                  state: { "name": $("#state").val(), "Counties": [{ "Name": $("#county").val() }] }
              };
  
  
  $.getJSON(uri + 'getProducts', query)
                .done(function (data) {
                    $('#product').text(data);
                    console.log(data);
                })
                .fail(function (jqXHR, textStatus, err) {
                    $('#product').text('Error: ' + err);
                });
  </code></pre>
  
  <p>Here's an example request:</p>
  
  <pre><code>http://localhost:47503/api/product/getProducts?username=auser&amp;password=apassword&amp;state%5Bname%5D=CO&amp;state%5BCounties%5D%5B0%5D%5BName%5D=Boulder
  </code></pre>
  
  <p>I've tried attribute routing, tried calling from the browser address bar, tried simplifying the input to just username and password, no change.  All the fields of <code>query</code> are always null.  I also tried changing it to return a <code>IHttpActionResult</code>, which is the main difference between this and the working controller (other than what it does of course) but that had no effect.  The method is getting called, so the routing is working, but there is something wrong with the argument binding that I'm just not seeing.  </p>
  
  <p>Does anybody see the problem or just a direction to look?  I've spent all morning reading tutorials and SO questions and everything I'm seeing indicates that I'm on the right track.  Maybe there's some little thing I'm missing because I've been staring at it too long.</p>