am passing a json string collection from Android device to .net MVC HttpPost method. my json string is like.
{"collection",[{"Name":"A","Age":"12","Class":"10"},{"Name":"B","Age":"12","Class":"10"}]}
My MVC control function is:
[HttpPost]
public ActionResult Create(string[] collection)
{
try
{
// TODO: Add insert logic here
JavaScriptSerializer json_serializer = new JavaScriptSerializer();
List<Model.StudentBehaviour> stdbehaviour_list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.StudentBehaviour>>(collection);
Lib.StudentModule.StudentManager.InsertStudentBehaviours(stdbehaviour_list);
return Json("success", JsonRequestBehavior.AllowGet);
}
catch
{
return Json("exception", JsonRequestBehavior.AllowGet);
}
}
the function parameter value is
collection = "(Collection)"
expected value in collection is
collection[0]
Name = A
Age = 12
Class = 10
collection[1]
Name = B
Age = 12
Class = 10
please help to fix this issue
Thanks in advance