fastjson 去掉双引号的field bug

sundy-li 发布于 2016/05/17 15:32
阅读 2K+
收藏 0


    public void testUnmarshFastjson(){

        byte []bs = "{b:false,i:2,f:3.0}".getBytes();
        B b = JSON.parseObject(bs, B.class, Feature.AllowUnQuotedFieldNames);
        JSON.DEFAULT_GENERATE_FEATURE =  SerializerFeature.config( JSON.DEFAULT_GENERATE_FEATURE,SerializerFeature.QuoteFieldNames , false);
        System.out.println(JSON.toJSONString(b));

    }

其中

 public class B {
    public boolean b;
    public int i;
    public float f;
}

 输出 {"b":false,f:3,i:2} , 事实上 b不应该带双引号,是否第一个key-value输出的时候,没有调用SerializerFeature的判断?

环境: MacBook-Pro.local 13.4.0 Darwin Kernel Version 13.4.0: Wed Mar 18 16:20:14 PDT 2015; root:xnu-2422.115.14~1/RELEASE_X86_64 x86_64

jdk : java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)


加载中
0
wenshao
wenshao
这样提问不便于问题的跟踪管理,能否反馈到这里:https://github.com/alibaba/fastjson/issues
0
sundy-li
sundy-li
https://github.com/alibaba/fastjson/issues/634 已经提交
返回顶部
顶部