Jackson

http://wiki.fasterxml.com/JacksonInFiveMinutes

参考
http://www.cnblogs.com/hoojo/archive/2011/04/22/2024628.html

复杂json处理
String s = "{\"status\":\"success\",\"result\":{\"count\":\"2\",\"list\":[{\"id\":\"123\",\"name\":\"jack\"},{\"id\":\"567\",\"name\":\"tom\"}]}}";
        
ObjectMapper mapper = new ObjectMapper(); 
        
Map<String, Object> userList = mapper.readValue(s, Map.class);
Map<String, Object> result = (Map<String, Object>) userList.get("result");
List<Map<String, String>> list = (List<Map<String, String>>) result.get("list");
        
System.out.println(list.get(0).get("name"));

猜你喜欢

转载自lysunki.iteye.com/blog/2219305