小编use*_*211的帖子

从MVC控制器返回Json数据

   public ActionResult About()
    {
        List<Stores> listStores = new List<Stores>();
        listStores = this.GetResults("param");
        return Json(listStores, "Stores", JsonRequestBehavior.AllowGet);
    }
Run Code Online (Sandbox Code Playgroud)

使用上面的代码,我可以得到以下结果

[{"id":"1","name":"Store1","cust_name":"custname1","telephone":"1233455555","email":"abc@ac.com","geo":{"latitude":"12.9876","longitude":"122.376237"}},

{"id":"2","name":"Store2","cust_name":"custname2","telephone":"1556454","email":"nfnf@ac.com","geo":{"latitude":"12.9876","longitude":"122.376237"}},
Run Code Online (Sandbox Code Playgroud)

我怎样才能以下面的格式得到结果?

{

"stores" : [
{"id":"1","name":"Store1","cust_name":"custname1","telephone":"1233455555","email":"abc@ac.com",
"geo":{"latitude":"12.9876","longitude":"122.376237"}},

{"id":"2","name":"Store2","cust_name":"custname2","telephone":"1556454","email":"nfnf@ac.com","geo":{"latitude":"12.9876","longitude":"122.376237"}} ] 
}
Run Code Online (Sandbox Code Playgroud)

我想stores在数据的开头有.

请帮助我这方面.

asp.net-mvc json

3
推荐指数
1
解决办法
2万
查看次数

标签 统计

asp.net-mvc ×1

json ×1