title: How to pass complex JSON object to ASP.net controller
body: <p>I want to pass a complex JSON object. But when I debug the Controller Action all virtual Properties are null. Working with ASP.NET, EF and CF.</p>
  
  <p>JSON is send:</p>
  
  <pre><code>    POST http://localhost:53214/api/trans/ HTTP/1.1
      Pragma: no-cache
      Content-Type: application/json; charset=utf-8
      Host: localhost:53214
      Content-Length: 221
  
  {
      "trans": {
          "Location": {
              "locID": 2
          }
      }
  }
  </code></pre>
  
  <p>The Model trans:</p>
  
  <pre><code>    public class trans
      {
          [Key]
          public int tID { get; set; }
          //public int? locID { get; set; }
          public virtual Location Location { get; set; }
  
      }
  }
  </code></pre>
  
  <p>So when I always post the JSON via Fiddler all Virtual properties are null.</p>
  
  <p><img src="https://i.stack.imgur.com/NeUto.png" alt="Debugsession"></p>
  
  <p>Before I worked with Foreign Keys as commented in the Model. That works fine.</p>
  
  <p>I want to rebuild the code to optimize the code itself.</p>
  
  <p>How can I initialize the Properties and deserialize the JSON correct?</p>
  
  <p>Regards
  Marcus</p>