java 处理 嵌套 json数据
{"page":1,"commentcount":9,"commentcountall":9,"commentlist":[{"ReplyId":202601,"RObj...
{"page":1,"commentcount":9,"commentcountall":9,"commentlist":[{"ReplyId":202601,"RObjId":449342,"RReplyDate":"\/Date(1423107970393+0800)\/","RContent":"\u8f66\u4e0d\u9519","RTargetReplyId":0,"RTargetMemberId":0,"RMemberId":14957993,"RMemberName":"\u8d85\u7ea7\u7237\u4eec31","RFloor":9,"RMemberSex":0,"RContentLength":3,"CreateType":0,"RJson":"","SpType":"","replydate":"12\u5c0f\u65f6\u524d","Duihua":0,"RUp":0,"ImgId":0,"RStatus":0,"RMemberType":0}]} 怎么获取这个json的全部值 用Java
展开
1个回答
展开全部
jackson.jar fastjson.jar
用这些现成的库取就行了
用这些现成的库取就行了
追问
能给个实例么 我用的jackson没解决这个问题
追答
Map json = new ObjectMapper().readValue("{\"page\": 1, \"commentcount\": 9, \"commentcountall\": 9, \"commentlist\": [ {\"a\":1,\"b\":2} ]}", Map.class);
System.out.println(((Map)((List)json.get("commentlist")).get(0)).get("a"));
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询