title: C# MVC - Passing object with list of another object inside
body: <p>I want to post an object that has list of another object inside, <code>MVC</code> is receiving the object as null.</p>
  
  <p><strong>MVC Post</strong></p>
  
  <pre><code>[HttpPost]
  public ActionResult Create(ObjectWithList objectWithList) { 
    // While debugging objectWithList has its properties null
  }
  </code></pre>
  
  <p><strong>ObjectWithList</strong></p>
  
  <pre><code>public class ObjectWithList
  {
      public List&lt;Foo&gt; Foo { get; set; }
      public AnotherFoo AnotherFoo { get; set; }
  }
  </code></pre>
  
  <p>Foo and AntoherFoo are classes with normal properties, like string, etc.</p>
  
  <p>Using Postman I POST:
  Headers: Content-Type as application/json
  Body (raw):</p>
  
  <pre><code>{
      "Foo": [
          {
            "Name": "test"
          },
          {
           "Name": "test"
          }
     ],
     "AnotherFoo": {
         "Name": "asd",
         "Email": "asd@asd.com"
     }
  }
  </code></pre>
  
  <p>If I just pass "Foo" empty:</p>
  
  <pre><code>{
      "Foo": [
              {}
      ]
      ...
  </code></pre>
  
  <p>it works, (fills AnotherFoo). But as soon as i try to pass something inside Foo, MVC gets everything as null.</p>
  
  <p>I'm correctly naming the properties of Foo and AnotherFoo on the JSON</p>