首页 新闻 会员 周边

关于JSON的问题

0
[已解决问题] 解决于 2012-12-11 17:20

如何在MVC的控制器中将字符串转换为JSON,还有就是如何将几个JSON变为一个XML  求指教   最好详细点

呓语鑫的主页 呓语鑫 | 菜鸟二级 | 园豆:313
提问于:2012-11-29 18:30
< >
分享
最佳答案
0
        public ActionResult GetAllUserInfos()
        {
            //
            //分页的数据
            //
            int pageIndex = Request["page"] == null ? 1 : int.Parse(Request["page"]);
            int pageSize = Request["rows"] == null ? 10 : int.Parse(Request["rows"]);

            int total = 0;
            var data = _userInfoService.LoadPagerEntities(pageSize, pageIndex, out total, u => true, true, u => u.ID);

            var result = new { total = total, rows = data };

            return Json(result, JsonRequestBehavior.AllowGet);
        }
可以参考一下!
奖励园豆:5
Kencery | 菜鸟二级 |园豆:357 | 2012-11-29 23:28
其他回答(1)
0

几个JSON变为一个XML 

需要有一个固定的结构就可以,网上有很多的JSON->xml 或者是xml->JSON 的方法的。可以直接拿来用

http://cn.bing.com/search?setmkt=zh-CN&q=c%23+json+xml

chenping2008 | 园豆:9836 (大侠五级) | 2012-11-29 22:07
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册