后台解析Json数组

来源:互联网 发布:mac svn上传文件 编辑:程序博客网 时间:2024/04/28 16:57

从前端获得的json

String result = request.getparameter("myJson");

result后台打印如下

      {"result":0,"msg":"查询成功","obj":[
{"id":"ee9ba4e87d6f4041aef344899fc9e199",
"isNewRecord":,
"remarks":"",
"createDate":" ",
"updateDate":"",
"vname":" ",
"idcard":"",
"officeName":"",
"xjCheckResult":"",
"xjCheckType":"",
"menuName":"",
"menuId":,
"officeId":"",
"xjCheckItems":"",
"companyLongitude":"",
"companyLatitude":"",
"xjCheckLongitude":"",
"xjCheckLatitude":"",
"companyCheckDistance": ,
"pname":""},


{"id":"ee9ba4e87d6f4041aef344899fc9e199",
"isNewRecord":,
"remarks":"",
"createDate":" ",
"updateDate":"",
"vname":" ",
"idcard":"",
"officeName":"",
"xjCheckResult":"",
"xjCheckType":"",
"menuName":"",
"menuId":,
"officeId":"",
"xjCheckItems":"",
"companyLongitude":"",
"companyLatitude":"",
"xjCheckLongitude":"",
"xjCheckLatitude":"",
"companyCheckDistance": ,
"pname":""},


{"id":"ee9ba4e87d6f4041aef344899fc9e199",
"isNewRecord":,
"remarks":"",
"createDate":" ",
"updateDate":"",
"vname":" ",
"idcard":"",
"officeName":"",
"xjCheckResult":"",
"xjCheckType":"",
"menuName":"",
"menuId":,
"officeId":"",
"xjCheckItems":"",
"companyLongitude":"",
"companyLatitude":"",
"xjCheckLongitude":"",
"xjCheckLatitude":"",
"companyCheckDistance": ,
"pname":""}
]}


//先获得json串中的obj,用fastjson

JSONObject obj = new JSONObject(result);
String aa = obj.getString("obj");

//再存入自己的list
List<myBean> bbList = JSON.parseArray(aa, myBean.class);

0 0
原创粉丝点击