开源项目主页: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);
}
}
新闻热点
疑难解答