主要代码如下:
public JsonResult Test() { string s = Request.Form.ToString(); JavaScriptSerializer jss = new JavaScriptSerializer(); var sth = jss.Deserialize<TestModel>(HttpUtility.UrlDecode(s)); //var lst = jss.Deserialize<IList<Dictionary<string, string>>>(HttpUtility.UrlDecode(s)); //s = Request.QueryString[0]; // //to do sth about the data: //... //... return Json(new { id = 1, msg = "ch" }); }
当然,也可以直接利用微软的Newtonsoft.Json.JsonConvert.DeserializeObject<T>(strJson)
http://download.csdn.net/detail/yekeyishuo/6471375