fastjson和jackson
![](http://www.cncsto.com/contentimg/2.jpg)
fastjson前言
fastJson是阿里巴巴出品的一个json序列化工具。
常用方法
1:public static String toJSONString(Object object)
将对象序列化json字符串;
2:public static String toJSONString(Object object, SerializerFeature... features)
将对象序列化json字符串,并保留类特征,在将json字符串反序列化为对象时,序列化前必须用这个进行方法进行序列化,否则反序列化失败;
3:public static Object parse(String text)
将字符串反序列化为对象,若要反序列化为自己定义的对象,即向下强转,则必须使用ParserConfig.getGlobalInstance().addAccept("com.example.demo.entity.")
进行白名单设置
4:public static JSONObject parseObject(String text)
将json字符串序列化为json对象。
原文:https://www.cnblogs.com/xiaofengshan/p/14750480.html