title: ASP.NET MVC3 JSON Model-binding with nested class
body: <p>In MVC3, is it possible to automatically bind javascript objects to models if the model has nested objects? My model looks like this:</p>
  
  <pre><code> public class Tweet
   {
      public Tweet()
      {
           Coordinates = new Geo();
      }
      public string Id { get; set; }
      public string User { get; set; }
      public DateTime Created { get; set; }
      public string Text { get; set; }
      public Geo Coordinates { get; set; } 
  
  }
  
  public class Geo {
  
      public Geo(){}
  
      public Geo(double? lat, double? lng)
      {
          this.Latitude = lat;
          this.Longitude = lng;
      }
  
      public double? Latitude { get; set; }
      public double? Longitude { get; set; }
  
      public bool HasValue
      {
          get
          {
              return (Latitude != null || Longitude != null);
          }
      }
  }
  </code></pre>
  
  <p>When I post the following JSON to my controller everything except "Coordinates" binds successfully:</p>
  
  <pre><code>{"Text":"test","Id":"testid","User":"testuser","Created":"","Coordinates":{"Latitude":57.69679752892457,"Longitude":11.982091465576104}}
  </code></pre>
  
  <p>This is what my controller action looks like:</p>
  
  <pre><code>    [HttpPost]
      public JsonResult ReTweet(Tweet tweet)
      {
          //do some stuff
      }
  </code></pre>
  
  <p>Am I missing something here or does the new auto-binding feature only support primitive objects?</p>