Json的解析
来源:互联网 发布:尔雅网络课程刷课 编辑:程序博客网 时间:2024/05/22 09:42
Result:{ "project": { "code": "lmx", "description": "", "firstparty": "", "id": 161, "isdelete": "n", "managercode": "AAA", "managername": "", "membercode": "", "membername": "", "milestonestate": "", "name": "lmx", "ownercode": "", "ownername": "", "secondparty": "", "shortname": "lmx", "type": "" }, "projectWeek": "", "missNextWeekList": [{ "code": "lmx001", "content": "", "description": "", "endtime": "2015-08-19", "finishtime": "2015-08-15", "id": 161, "managercode": "", "managername": "", "name": "lmx001", "priority": "", "projectcode": "lmx", "projectname": "", "publishtime": "", "receivercode": "LLL", "receivername": "", "receivetime": "2015-08-13", "starttime": "2015-08-13", "state": "1", "timecost": "" }, { "code": "lmx004", "content": "", "description": "", "endtime": "2015-08-26", "finishtime": "", "id": 164, "managercode": "", "managername": "", "name": "lmx004", "priority": "", "projectcode": "lmx", "projectname": "", "publishtime": "", "receivercode": "HHH", "receivername": "", "receivetime": "2015-08-17", "starttime": "2015-08-13", "state": "1", "timecost": "" }], "missThisWeekList": [{ "code": "lmx001", "content": "", "description": "", "endtime": "2015-08-19", "finishtime": "2015-08-15", "id": 161, "managercode": "", "managername": "", "name": "lmx001", "priority": "", "projectcode": "lmx", "projectname": "", "publishtime": "", "receivercode": "LLL", "receivername": "", "receivetime": "2015-08-13", "starttime": "2015-08-13", "state": "1", "timecost": "" }, { "code": "lmx004", "content": "", "description": "", "endtime": "2015-08-26", "finishtime": "", "id": 164, "managercode": "", "managername": "", "name": "lmx004", "priority": "", "projectcode": "lmx", "projectname": "", "publishtime": "", "receivercode": "HHH", "receivername": "", "receivetime": "2015-08-17", "starttime": "2015-08-13", "state": "1", "timecost": "" }], "missFinshCount": 1, "missRunningCount": 3, "memberCount": 4}
List list = staffService.loadAllStaff(name); for(int i=0;i<list.size();i++){ Staff sta = (Staff)list.get(i); System.out.println(sta.getName()+" "+sta.getCode());}JSONArray jsonArr = JSONUtil.toJSONArray(list);System.out.println("获得的JSON字符串为:"+jsonArr);
输出结果:
存入模式:讲list一个个存入。
直接解析:result代表第一个list内数据
result[1].cellphone
[{ "cellphone": "4", "certification": "", "code": "4", "email": "5", "experience": "", "id": 134, "name": "4", "other": "", "qq": "", "remark": "", "skill": "", "wechat": ""},{ "cellphone": "543543", "certification": "", "code": "43543", "email": "543543543", "experience": "", "id": 133, "name": "43543", "other": "", "qq": "", "remark": "", "skill": "", "wechat": ""},{ "cellphone": "123213", "certification": "123213", "code": "123213", "email": "123213", "experience": "123213", "id": 101, "name": "123213", "other": "123213", "qq": "123213", "remark": "", "skill": "123213", "wechat": "123213"},{ "cellphone": "765765", "certification": "", "code": "aaa", "email": "657657657777776555777777", "experience": "", "id": 99, "name": "AAA", "other": "", "qq": "77657657", "remark": "", "skill": "", "wechat": ""},{ "cellphone": "113243243243223", "certification": "435435", "code": "woshidaima", "email": "1132432432432", "experience": "435435435", "id": 98, "name": "6", "other": "435435", "qq": "123", "remark": "45435435435435435", "skill": "435435435", "wechat": "435435435"},{ "cellphone": "2", "certification": "435", "code": "234", "email": "2", "experience": "54354343", "id": 97, "name": "2", "other": "543543", "qq": "34543", "remark": "543543", "skill": "435435", "wechat": "435435"}]
json数组,是直接把list放到一个
存入模式,list配一个key后存入。
解析:
var code=result.missNextWeekList[0].code;
{ "error": 0, "status": "success", "date": "2014-04-01", "results": [{ "currentCity": "\u5317\u4eac", "weather_data": [{ "date": "\u5468\u4e8c(\u4eca\u5929, \u5b9e\u65f6\uff1a22\u2103)", "dayPictureUrl": "http:\/\/www.baidu.com\/aladdin\/img\/new_weath\/bigicon\/7.png", "nightPictureUrl": "http:\/\/api.map.baidu.com\/images\/weather\/night\/yin.png", "weather": "\u973e\u8f6c\u9634", "wind": "\u5fae\u98ce", "temperature": "23 ~ 11\u2103", "dayPictureurl": "http:\/\/api.map.baidu.com\/images\/weather\/day\/mai.png" }, { "date": "\u5468\u4e09", "dayPictureUrl": "http:\/\/api.map.baidu.com\/images\/weather\/day\/yin.png", "nightPictureUrl": "http:\/\/api.map.baidu.com\/images\/weather\/night\/yin.png", "weather": "\u9634", "wind": "\u5fae\u98ce", "temperature": "21 ~ 11\u2103" }, { "date": "\u5468\u56db", "dayPictureUrl": "http:\/\/api.map.baidu.com\/images\/weather\/day\/qing.png", "nightPictureUrl": "http:\/\/api.map.baidu.com\/images\/weather\/night\/qing.png", "weather": "\u6674", "wind": "\u5317\u98ce3-4\u7ea7", "temperature": "21 ~ 10\u2103" }, { "date": "\u5468\u4e94", "dayPictureUrl": "http:\/\/api.map.baidu.com\/images\/weather\/day\/qing.png", "nightPictureUrl": "http:\/\/api.map.baidu.com\/images\/weather\/night\/qing.png", "weather": "\u6674", "wind": "\u5fae\u98ce", "temperature": "24 ~ 9\u2103" }] }]}
0 0
- json对象的解析,jquery 解析json
- json的解析方式
- Android的JSON解析
- json 的数据解析
- 解析JSON的过程
- jQuery的JSON解析
- JSON的解析
- 解析JSON的例子
- JSON数据的解析
- Android的Json解析
- Android的JSON解析
- Json的解析
- Android的JSON解析
- android json的解析
- 关于json的解析
- 解析自己的json
- 另类Json的解析
- JSon数据的解析
- Tomcat – java.lang.OutOfMemoryError: PermGen space
- android parse init.rc
- Python一日一练10----快速排序
- Android Studio (二)——使用技巧
- markdown_语法
- Json的解析
- JavaScript的总结博客
- #!/bin/sh 和 #!/bin/bash 区别 2013年3月14日
- 史上最详细Android集成QQ,微信,微博分享(不用第三方)持续更新中
- JavaScript判断数据类型总结
- 取消RHEL的注册提醒
- Linux常用Terminal命令
- Android 如何让EditText不自动获取焦点
- shell变量$#,$@,$0,$1,$2的含义