title: ASP.NET MVC passing complex type into controller problem
body: <p>I have a problem passing in a complex type into a controller.</p>
  
  <p>Here is how my Model looks like:</p>
  
  <pre><code>public class Party
  {
      [XmlAttribute]
      public int RsvpCode { get; set; }
      public List&lt;Guest&gt; Guests { get; set; }
      public string Comments { get; set; }
  }
  
  public class Guest
  {
      [XmlAttribute]
      public string Name { get; set; }
      [XmlAttribute]
      public int MealOption { get; set; }
      [XmlAttribute]
      public bool Attending { get; set; }
  }
  </code></pre>
  
  <p>My controller method looks like this:</p>
  
  <pre><code>    public JsonResult Submit(Party party)
      {
          return Json(party);
      }
  </code></pre>
  
  <p>and I'm trying to doing my ajax call like this:</p>
  
  <pre><code>var party = { RsvpCode: 1, Guests: [{ Name: "test asdfasdf", MealOption: 1, Attending: true }, { Name: "test asdfasdf", MealOption: 1, Attending: true}] };
  
                  $.getJSON("/Rsvp/Submit", party, function(response) {
                      alert(response);
                  });
  </code></pre>
  
  <p>Something's going wrong but I'm not sure what. I'm getting anything returned to me in the alert statement. Any ideas?</p>
  
  <p>I've also tried looking at the value that's being submitted into the controller's method and it doesn't look right. I'm losing the information somewhere in the ajax call.</p>
  
  <p>I also tried this creating my party object like this and it didn't work:</p>
  
  <pre><code>var party = { "RsvpCode": 1, "Guests": [{ "Name": "test asdfasdf", "MealOption": 1, "Attending": true }, { "Name": "test asdfasdf", "MealOption": 1, "Attending": true}], "Comments": "testdsfsdf" };
  </code></pre>