public ActionResult About()
{
List listStores = new List();
listStores = this.GetResults(「param」);
return Json(listStores, 「Stores」, JsonRequestBehavior.AllowGet);
}
使用上面的代碼中,我能得到以下結果:JSON序列在asp.net mvc的C#
[{"id":"1","name":"Store1","cust_name":"custname1","telephone":"1233455555",
"email":"[email protected]","geo":{"latitude":"12.9876","longitude":"122.376237"}},
{"id":"2","name":"Store2","cust_name":"custname2","telephone":"1556454",
"email":"[email protected]","geo":{"latitude":"12.9876","longitude":"122.376237"}},
我將如何能得到以下結果格式?在結果的開始將需要商店。
{
"stores" : [
{"id":"1","name":"Store1","cust_name":"custname1","telephone":"1233455555",
"email":"[email protected]",
"geo":{"latitude":"12.9876","longitude":"122.376237"}},
{"id":"2","name":"Store2","cust_name":"custname2","telephone":"1556454",
"email":"[email protected]","geo":{"latitude":"12.9876","longitude":"122.376237"
}} ] }
有你爲什麼需要'stores'什麼特別的原因作爲對象的第一個成員? – 2012-03-07 02:37:11