title: Passing JSON Object and List of Objects to ASP.Net Controller
body: <p>I need some help with the hereunder please. I have these 2 models and the method I will be using them in hereunder.</p>
  
  <pre><code>public class RoleModel
  {
      public string Name { get; set; }
      public string Description { get; set; }
      public List&lt;PermissionGroupModel&gt; PermissionGroups { get; set; }
  }
  
  public class PermissionGroupModel
  {
      public int PermissionGroupID { get; set; }
      public string Name { get; set; }
      public string Description { get; set; }
  }
  
   [HttpPost]
   public bool CreateRole(RoleModel r){
    //code goes here
  }
  </code></pre>
  
  <p>I am trying to post data to the CreateRole() method via AJAX and using a debug break to inspect the 'r' parameter to see if the model is getting populated. This is the AJAX call I am using to test it out.</p>
  
  <pre><code>$.ajax({
          type: "POST",
          url: "/BackOffice/CreateRole",
          data:  {"Name": "Test Name", "Description": "Test Desc", "PermissionGroups": ["Name": "Group Name", "Description": "Test Desc"]},
          success: function (data) {},
          complete: function (data) {}
        });
  </code></pre>
  
  <p>When the request is made and I inspect the parameter in visual studio. The RoleModel Name and Description Keys are populated and PermissionGroups Count is 1 but the keys in PermissionGroups are not being populated. </p>
  
  <p>Can anyone suggest any way I can pass a JSON object with a list of objects in it.</p>
  
  <p>Thanks in advance.</p>