时间:2020-10-17 23:18:51 | 栏目:JAVA代码 | 点击:次
开源项目主页:https://github.com/dongfangshangren/Zson
import test.bean.SomeBean;
public class TestZson{
public static void main(){
//Serialize
List<SomeBean> list=new ArrayList<SomeBean>();
String json=new JsonSerializer().prettyFormat(2).ignoreNull(false)
.dateFormat("yyyy-MM-dd").serialize(list);
//Deserilize
Type type=new TypeReference<List<SomeBean>>(){}.getType();
List<SomeBean> result=(List<SomeBean>)new JsonDeserializer().deserialize(json,type);
}
}