一、阿里巴巴的fastJson
fastjson的github地址:https://github.com/alibaba/fastjson
fastjson的文档地址:https://github.com/alibaba/fastjson/wiki/%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98
FastJson在复杂类型的Bean转换Json上会出现一些问题,可能会出现引用的类型,导致Json转换出错,需要制定引用。
FastJson采用独创的算法,将parse的速度提升到极致,超过所有json库。
- bean转换json: toJSONString
- json转换bean:parseObject
- json转换复杂的bean,比如List,Map:parseObject
- 通过json对象直接操作json
二、Google的Gson
gson的github地址:https://github.com/google/gson
gson官方文档:https://github.com/google/gson/blob/master/UserGuide.md
Gson是目前功能最全的Json解析