title: ASP.NET Core Posting Array Object JSON
body: <p>I'm trying to post an array of Object in my view to my controller but params are null i saw that for just a simple object I need to put [FromBody] in my controller action.</p>
  
  <p>Here is my JSON:</p>
  
  <pre class="lang-json prettyprint-override"><code>{
    "monJour": [
      {
        "openTime": "04:00",
        "closedTime": "21:30",
        "id": "0"
      },
      {
        "openTime": "08:00",
        "closedTime": "17:30",
        "id": "1"
      },
      {
        "openTime": "08:00",
        "closedTime": "17:30",
        "id": "2"
      },
      {
        "openTime": "08:00",
        "closedTime": "17:30",
        "id": "3"
      },
      {
        "openTime": "08:00",
        "closedTime": "17:30",
        "id": "4"
      },
      {
        "openTime": "08:00",
        "closedTime": "17:30",
        "id": "5"
      },
      {
        "openTime": "08:00",
        "closedTime": "17:30",
        "id": "6"
      }
    ]
  }
  </code></pre>
  
  <p>Here is my Ajax Request :</p>
  
  <pre><code>function SendAllDay() {
      var mesJours = {};
      var monJour = [];
      mesJours.monJour = monJour;
  
      var senddata ='';
  
      $('div[id^="Conteneur"]').each(function () {
          var idDiv = $(this).attr("id");
          var jour = idDiv.substr(9, idDiv.length - 9);
          var opentps = $("#O" + jour).val();
          var closetps = $("#C" + jour).val();
          var monid = $("#id" + jour).val();
  
          monJour = {
              openTime: opentps,
              closedTime: closetps,
              id: monid
          }
  
          mesJours.monJour.push(monJour);
      });
  
      $.ajax({
          url: '@Url.Action("ReceiveAll")',
          dataType: 'json',
          type: 'POST',
          //data: JSON.stringify(monJours),
          data: JSON.stringify(mesJours),
          contentType:'application/json',
          success: function (response) {
              console.log('ok');
              //window.location.reload();
          },
          error: function (response) {
              console.log('error');
              //alert(response)
              //window.location.reload();
          }
      });
  }
  </code></pre>
  
  <p>Here is my Action:</p>
  
  <pre><code>[HttpPost]
  public void ReceiveAll([FromBody]ReceiveTime [] rt) { }
  </code></pre>
  
  <p>Here is my Class:</p>
  
  <pre><code>public class ReceiveTime
  {
      public string openTime { get; set; }
      public string closedTime { get; set; }
      public string id { get; set; }
  }
  </code></pre>
  
  <p>Any help is appreciated :)</p>