title: JSON Array of Objects to Model in WebAPI using FromBody
body: <p>I am creating a Web Api method that should accept a list of objects via XML or JSON and add them to a database.</p>
  
  <p>Here is a very basic version of what I currently have:</p>
  
  <pre><code>[HttpPost]
  public HttpResponseMessage Put([FromBody]ProductAdd productAdd)
  {
      //do stuff with productadd object
      return Request.CreateResponse(HttpStatusCode.OK);
  }
  </code></pre>
  
  <p>The model structure of the list of objects it accepts is as follows:</p>
  
  <pre><code>public class ProductAdd
  {
      public List&lt;ProductInformation&gt; Products { get; set; }
  }
  
  public class ProductInformation
  {
      public string ProductName { get; set; }
  }
  </code></pre>
  
  <p>The above works perfectly when I am using XML - (Content-Type: application/xml)</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;ProductAdd&gt;
      &lt;Products&gt;  
          &lt;ProductInformation&gt;
              &lt;ProductName&gt;Seahorse Necklace&lt;/ProductName&gt;
          &lt;/ProductInformation&gt;
      &lt;/Products&gt;
      &lt;Products&gt;  
          &lt;ProductInformation&gt;
              &lt;ProductName&gt;Ping Pong Necklace&lt;/ProductName&gt;
          &lt;/ProductInformation&gt;
      &lt;/Products&gt;
  &lt;/ProductAdd&gt;
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/tRBwp.png" alt="Products has 2 Items"></p>
  
  <p>But when I attempt to feed the same thing in using JSON (Content-Type: application/json), the Products list is empty</p>
  
  <pre><code>{
    "ProductAdd": {
      "Products": [
        {
          "ProductInformation": { "ProductName": "Seahorse Necklace" }
        },
        {
          "ProductInformation": { "ProductName": "Ping Pong Necklace" }
        }
      ]
    }
  }
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/5JU1l.png" alt="Products is null"></p>
  
  <p>Is there an issue with the JSON serializer when there is an array of objects within another object ?</p>
  
  <p>Any ideas on what will fix this ?</p>
  
  <p>Thanks</p>
  
  <p>Edit:
  What serializers are you using for XML and Json?
  XML: XmlSerializer 
  JSON: Newtonsoft</p>