阿里巴巴fastjson: 世界上最快的 Java json 解析包, 2个bug

来源:互联网 发布:蚌埠巨人网络 编辑:程序博客网 时间:2024/06/01 07:35

阿里巴巴fastjson, 国产荣耀, 力克google的gson包

请看fastjson生成和解析json数据,序列化和反序列化数据

最新版本:
1.2.6
1.2.4
1.2.2
1.1.46

FastJSON、Gson和Jackson性能对比

请移步http://blog.csdn.net/accountwcx/article/details/50252657

一个bug

版本:fastjson-1.1.36.jar

当 Entity 类的 field 以s开头 且是private时无法用 JSON.toJSONString() 转换为 String。
只能令 field 为 public 。

import com.alibaba.fastjson.JSON;public class Test {    private String sFhah="1";    //public String sFhah="1";    public String getsFhah() {        return sFhah;    }    public void setsFhah(String sFhah) {        this.sFhah = sFhah;    }    public static void main(String[] args){        Test na=new Test();        na.setsFhah("dfa");        JSON.toJSONString(na);    }}

bug- JSON.toJSONString()返回值带$ref

请移步
http://www.cnblogs.com/zjrodger/p/4630237.html

JSON.toJSONString(returnDto, SerializerFeature.DisableCircularReferenceDetect);
0 0