Sending JSON string to MVC controller fails
<p>I am using VS2015, C# and trying to pass JSON array to MVC controller.</p>

<p>JSON string I am trying to send is (I've checked it's valid JSON):</p>

<pre><code>[{"iUSER_KEY":"130000096","iUSNW_KEY":"160001926"},{"iUSER_KEY":"160000209","iUSNW_KEY":"160001779"}]
</code></pre>

<p>Error I am receiving is:</p>

<blockquote>
  <p>[ArgumentException: Invalid JSON primitive: keysList.]</p>
</blockquote>

<p>On a client my code is:</p>

<pre><code>$('.do-remove').click(function (e) {

      e.preventDefault();

  var keys = [];
  $("#tableUSNW tbody tr").each(function () {

    var row = $(this);
    var checked = $(row).find("td &gt; input[id=inputChk]").is(":checked");

    if (checked === true) {

      var iUSER_KEY = $(row).attr("data-userkey");
      var iUSNW_KEY = $(row).attr("data-ref");
      var user = {iUSER_KEY: iUSER_KEY, iUSNW_KEY: iUSNW_KEY};
      keys.push(user);

      row.remove();
    }
  });

  keys = JSON.stringify(keys);

  $.ajax({
    type: "POST",
    url: '/newsinternal/UpdateUsnwRemove',
    traditional: true,
    contentType: "application/json; charset=utf-8",
    data: { keysList: keys },
    beforeSend: function () {
      $('#loader').show();
    },
    success: function (msg) {
      $('#loader').hide();          
    },
    error: function (xhr, ajaxOptions, thrownError) {
      $('#loader').hide();
      alert(xhr.responseText);
    }
  });
});
</code></pre>

<p>On the server (MVC controller method):</p>

<pre><code>[HttpPost]
public void UpdateUsnwRemove(List&lt;DTO_CAUSNW&gt; keysList)
{
  using (iDatabase baza = new iDatabase(iPUURE.Web.Configuration.GetConnectionString()))
  {
    CommDB db = new CommDB(baza, false);
    foreach (var item in keysList)
    {
      DTO_CAUSNW usnw = new DTO_CAUSNW();          
      usnw.cUSNW_STA = "9";
      iQuery qDelete = db.LoadInsertCAUSNW_BASE(usnw, "4");  // 1 = select, 2 = insert, 3 = update 4 = delete
    }
  }
}
</code></pre>

<p>And class DTO_CAUSNW:</p>

<pre><code>public class DTO_CAUSNW
{
    public int? iUSNW_KEY { get; set; } //user_news key 
    public string cUSNW_STA { get; set; } //status: 1=enable, 2/null=disable, 9=erased 
    public string cUSNW_SRT { get; set; } //sort: 1=internal news
    public DateTime? dUSNW_DAT { get; set; } //date of changed status

    public int? iNEWS_KEY { get; set; } //news key
    public int? iUSER_KEY { get; set; } //user key 

    public DateTime? dUSNW_DSI { get; set; } //time of signature
    public DateTime? dUSNW_DAU { get; set; } //time of user changed  
    public string cUSNW_STU { get; set; } //user status: 1=confirm, 2/null=not confirm
    public int? iUSNW_CPU { get; set; } //counter of postponed
    public string cUSNW_COM { get; set; } //comment
    public string cUSNW_NTO { get; set; } //note

    public DTO_CANEWS oNEWS { get; set; } //the news
    public DTO_BAUSER oUSER { get; set; } //the user
}
</code></pre>