1.jackjson 1.bean到json ObjectMapper m = new ObjectMapper(); String value = m.writeValueAsString(bean); 2.json到bean ObjectMapper m = new ObjectMapper(); TestPO test1 = m.readValue(json, TestPO.class); 3.日期的处理 bean到json时.默认是转换成timestamp类型的,即相对1970年…
版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/jadyer/article/details/24395015 完整版见https://jadyer.github.io/ 先列出来正确的解析代码,接着再描写叙述问题详情. 首先是用到的JavaBean package com.jadyer.model; public class User { private String name; private Book book; public String…
利用fastjson序列化对象为JSON 参考博客:http://blog.csdn.net/zeuskingzb/article/details/17468079 Step1:定义实体类 //用户类 public class User { private Long id; private String name; //增加get/set方法 } //定义组,1组有多个用户 public class Group { private Long id; private String name; pr…