title: Ajax post to ASP.net MVC controller - object properties are null
body: <p>I've got an ajax post being constructed like this:</p>
  
  <pre><code>var myData = [
      {
          id: "a",
          name: "Name 1"
      },
      {
          id: "b",
          name: "Name 2"
      }
  ];
  
  $.ajax({
      type: 'POST',
      url: '/myurl/myAction',
      data: { items: myData },
      dataType: 'json',
      error: function (err) {
          alert("error - " + err);
      }
  });
  </code></pre>
  
  <p>And an MVC controller:</p>
  
  <pre><code>[HttpPost]
  public JsonResult MyAction(MyClass[] items)
  {
  
  }
  </code></pre>
  
  <p><code>MyClass</code> is just a simple representation of the data:</p>
  
  <pre><code>public class MyClass {
      public string Name {get; set; }
      public string Id {get; set; }
  }
  </code></pre>
  
  <p>When the javascript makes the post request, the controller action does indeed receive 2 items, however the properties (id, name) in these items are null.  </p>
  
  <p>Checking the request in fiddler, the body looks like this:</p>
  
  <pre><code>Name                 | Value
  items[0][Name]       | Name 1
  items[0][Id]         | a
  items[1][Name]       | Name 2
  items[1][Id]         | b
  </code></pre>
  
  <p>Have I missed something?</p>