title: Post Array Json to .net core web api controller
body: <p>I have this code</p>
  
  <pre><code>    [HttpPost("[action]")]
      public IActionResult Add([FromBody] Player player)
      {
          PlayerService.Add(player);
          PlayerService.SaveChanges();
          return Created("Player created",player.Name);
      }
  </code></pre>
  
  <p>and this json </p>
  
  
  
  <pre class="lang-json prettyprint-override"><code>[
    {
      "name": "Olivier Giroud",
      "league": "Premier League",
      "currentTeam": "Arsenal"
    }
  ]
  </code></pre>
  
  <p>and everything is going ok.
  But if i want to send a json array </p>
  
  
  
  <pre class="lang-json prettyprint-override"><code>[ 
    { "name": "Olivier Giroud", "league": "Premier League", "currentTeam": "Arsenal" },    
    {"name": "Lucas Perez","league": "Premier League","currentTeam":"Arsenal"}
  ]
  </code></pre>
  
  <p>i get an exception "Object reference not set to an instance of an object.'
  ". I tried with List
  </p>
  
  <pre class="lang-json prettyprint-override"><code>public IActionResult Add([FromBody] List&lt; Player &gt;  players)    
  </code></pre>
  
  <p>or
  </p>
  
  <pre class="lang-json prettyprint-override"><code>public IActionResult Add([FromBody] IEnumerable &lt; Player &gt;  players)
  </code></pre>
  
  <p>or
  </p>
  
  <pre class="lang-json prettyprint-override"><code>public IActionResult Add([FromBody] Players[] players)
  </code></pre>
  
  <p>but without success. What should i do?</p>