public ActionResult About()
{
List<Stores> listStores = new List<Stores>();
listStores = this.GetResults("param");
return Json(listStores, "Stores", JsonRequestBehavior.AllowGet);
}
使用上面的代碼的JSON數據,我能得到以下結果返回從MVC控制器
[{"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
。
請在這方面幫助我。
像我這樣做
其他選項.. 。要學會更快地輸入:) – Tr1stan 2012-02-17 10:48:26