title: JSON list of users not binding to model in Web API
body: <p>I have a JSON object coming into a controller in Web API that isn't binding to my model. I'm testing it using Fiddler, with the following JSON in the body:</p>
  
  <pre><code>{
  "userList": {
      "user": [
          {
              "custCode": "test1",
              "userName": "TheDude",
              "admin": "false",
              "effectiveDate": "2/14/2014"
          },
          {
              "custCode": "test1",
              "userName": "Bob",
              "admin": "false",
              "effectiveDate": "2/14/2014"
          },
          {
              "custCode": "test1",
              "userName": "Ted",
              "admin": "false",
              "effectiveDate": "2/14/2014"
          },
          {
              "custCode": "test1",
              "userName": "Darryl",
              "admin": "false",
              "effectiveDate": "2/14/2014"
          }
      ]
  }
  </code></pre>
  
  <p>}</p>
  
  <p>I've included the classes built for the model and the controller method as well.</p>
  
  <pre><code>public class UserList
  {
      public List&lt;User&gt; userList { get; set; }
  }
  
  public class User
  {
      public string custCode { get; set; }
      public string userName { get; set; }
      public bool admin { get; set; }
      public DateTime effectiveDate { get; set; }
  }
  
  [HttpPost]
      public void CreateNewUser(UserList newUsers)
      {
          var conn = new SqlConnection(ConfigurationManager.ConnectionStrings["conn"].ConnectionString);
          conn.Open();
  
          try
          {
              foreach (var user in newUsers.userList)
              {
                  //SQL code is here
              }
          }
  
          finally
          {
              conn.Close();
              conn.Dispose();
          }
      }
  </code></pre>
  
  <p>Its hanging up on the foreach loop, giving me an "Object reference not set to an instance of an object" error. I'm noticing that when it first hits the method, the UserList object is null. I'd appreciate any observations on what I'm doing wrong.</p>