How can I post a JSON array to a Web API? It's working for single object.
This is what I've tried, but the controller seems to be returning 0 rather than the expected 3.
This is my JSON:
var sc = [{ "ID": "5", "Patient_ID": "271655b8-c64d-4061-86fc-0d990935316a", "Table_ID": "Allergy_Trns", "Checksum": "-475090533", "LastModified": "2015-01-22T20:08:52.013" }, { "ID": "5", "Patient_ID": "271655b8-c64d-4061-86fc-0d990935316a", "Table_ID": "Allergy_Trns", "Checksum": "-475090533", "LastModified": "2015-01-22T20:08:52.013" }, { "ID": "5", "Patient_ID": "271655b8-c64d-4061-86fc-0d990935316a", "Table_ID": "Allergy_Trns", "Checksum": "-475090533", "LastModified": "2015-01-22T20:08:52.013" }]; AJAX call:
$.ajax({ url: urlString, type: 'POST', data: sc, dataType: 'json', crossDomain: true, cache: false, success: function (data) { console.log(data); } }); Web API controller:
[HttpPost] public string PostProducts([FromBody]List<SyncingControl> persons) { return persons.Count.ToString(); // 0, expected 3 } 
scequal tonullbefore the request gets fired off, which seems like it could do this.