title: C# Http Post receive json from body
body: <p>I have this HttpPost method:</p>
  
  <pre><code>[HttpPost]    
  public string Test([FromBody]List&lt;Account&gt; accounts)
  {
     var json = JsonConvert.SerializeObject(accounts);
     Console.Write("success");
     return json;
  }
  </code></pre>
  
  <p>and this is my Account class:   </p>
  
  <pre><code>public class Account
  {
      public int accountId;
      public string accountName;
      public string createdOn;
      public string registrationNumber;
  }
  </code></pre>
  
  <p>This is my json file which i send with postman:</p>
  
  <pre><code>{
      "Account": [
      {
          "accountId": "1",
          "accountName": "A purple door",
          "createdOn": "25-07-2017",
          "registrationNumber": "purple"
      },
      {
          "accountId": "2",
          "accountName": "A red door",
          "createdOn": "26-07-2017",
          "registrationNumber": "red"
      },
      {
          "accountId": "3",
          "accountName": "A green door",
          "createdOn": "27-07-2017",
          "registrationNumber": "green"
      },
      {
          "accountId": "4",
          "accountName": "A yellow door",
          "createdOn": "25-07-2017",
          "registrationNumber": "yellow"
      }
      ]
  }
  </code></pre>
  
  <p>If i send this json my method doesn't work and it returns a null object.
  The only way to make it work is by sending the object only without the "Account" like this:</p>
  
  <pre><code>[
      {
        "accountId": "1",
        "accountName": "A purple door",
        "createdOn": "25-07-2017",
        "registrationNumber": "purple"
      },
      {
        "accountId": "2",
        "accountName": "A red door",
        "createdOn": "26-07-2017",
        "registrationNumber": "red"
      },
      {
        "accountId": "3",
        "accountName": "A green door",
        "createdOn": "27-07-2017",
        "registrationNumber": "green"
      },
      {
        "accountId": "4",
        "accountName": "A yellow door",
        "createdOn": "25-07-2017",
        "registrationNumber": "yellow"
      }
  ]
  </code></pre>
  
  <p>But i want the previous file format.
  How could my method receive the previous JSON ?</p>