Well, I think I will have to answer this indirectly. What you send to the server is an array of objects (in JSON format), but as soon as you start processing it in C #, the array of objects is now considered as a single C # object. Inside this object, your model expects one of the fields to be Collection of Associate.
That's right, when I work with JSON data similar to what was mentioned in this case, I prefer to use JOject Newtonsofts.
So, here is how I created a C # object with the JSON data you provided:
Your model is used:
public class ResponseStatus { public int SurveyId { get; set; } public int CreatorId { get; set; } public int GlobalAppId { get; set; } public Collection<Associate> AssociateList { get; set; } } public class Associate { public int AssociateId { get; set; } }
Made a routine that takes a string (JSON data) and returns an object of type ResponseStatus:
using System; using System.Collections.Generic; using Newtonsoft.Json.Linq; --------------------------------------------------------------------- public static ResponseStatus GetResponseStatusObject(string jsonData) { JObject jObject = JObject.Parse(jsonData); return jObject.ToObject<ResponseStatus>(); }
Now, when I call this method and pass the same JSON data that you provided, I get the following:

This may not solve your problem directly, but I hope it helps you in the right direction in understanding the serialization of an array / object when working with JavaScript / C #.
Good luck
source share