首页 新闻 赞助 找找看

easy UI接收后台传的json格式数据时解析不正确,求助

0
悬赏园豆:10 [待解决问题]

我在前台是这样写的

    int count = listUser.size(); // 求出总记录数
        // total键 存放总记录数,必须的
        jsonMap.put("total", count);
        Gson gson=new Gson();
        String gsonUser=gson.toJson(listUser);
        jsonMap.put("rows", gsonUser);// rows键 存放每页记录 list
        System.out.println(jsonMap);//打印正常
        return "jsonMap";
       

打印出来的jsonMap是

{total=2, rows=[

s{"id":1,"name":"郭","password":"123","age":"21","sex":"女","phoneNumber":"151","department":"技术部","state":"1"},{"id":81,"name":"维","password":"152","age":"21","sex":"女","phoneNumber":"152","department":"技术部","state":"1"}]}

 

后台解析代码:

 $(function(){  
            $('#dg').datagrid({     
                //url地址改为请求checkUserAction  
                url:'checkUserAction.action',  
                loadMsg:'Loading......',  
                queryParams:{type:''},
                //width:300,  
                fitColumns:true,  
                striped:true,  
                nowrap:true,  
                singleSelect:true,  
                pagination:true,  
                rowStyler: function(index,row){  
                    console.info("index" + index + "," + row)  
                },       

 

但是控制台信息显示,解析情况如下,怎么会是一个字符一个字符的解析呀,

index0, [                               send_query.action:32:21
index1,{                                send_query.action:32:21
index2,"                                 send_query.action:32:21
index3,i  send_query.action:32:21
index4,d  send_query.action:32:21
index5,"  send_query.action:32:21
index6,:  send_query.action:32:21
index7,1  send_query.action:32:21
index8,,  send_query.action:32:21
index9,"  send_query.action:32:21
index10,n  send_query.action:32:21
index11,a  send_query.action:32:21
index12,m  send_query.action:32:21
index13,e  send_query.action:32:21
index14,"  send_query.action:32:21

啊啊啊维宝啊的主页 啊啊啊维宝啊 | 初学一级 | 园豆:109
提问于:2017-09-22 17:03
< >
分享
所有回答(1)
0

哎呦喂,又是你啊,哈哈……………… ,一般前台解析json串用JSON.stringify()吧

让我发会呆 | 园豆:2929 (老鸟四级) | 2017-09-22 17:49

嘻嘻,缘分,我不太会用这个,方便加下扣扣跟我说吗?

支持(0) 反对(0) 啊啊啊维宝啊 | 园豆:109 (初学一级) | 2017-09-25 08:33

啊对了,扣扣是1457054547

支持(0) 反对(0) 啊啊啊维宝啊 | 园豆:109 (初学一级) | 2017-09-25 08:33
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册