有关restful 怎么把json对象直接映射成java对象
展开全部
用jackson吧,资料很多,给个demo吧
public static Object jsonToBean(String json, Class<?> cls) throws Exception {
ObjectMapper mapper = new ObjectMapper();
Object vo = mapper.readValue(json, cls);
return vo;
}
也可以看看这个博客 http://blog.csdn.net/songyongfeng/article/details/6932655
public static Object jsonToBean(String json, Class<?> cls) throws Exception {
ObjectMapper mapper = new ObjectMapper();
Object vo = mapper.readValue(json, cls);
return vo;
}
也可以看看这个博客 http://blog.csdn.net/songyongfeng/article/details/6932655
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询