开发者社区 问答 正文

fastjson2不支持SerializerFeature

fastjson2不支持SerializerFeature

我使用的版本是Fastjson2.0.20 ,jdk是1.8

下面是我的测试代码:

    Map<String,String> map=new HashMap<>();
    map.put("测试1",null);
    map.put("测试2","hello");
    String str = JSON.toJSONString(map,SerializerFeature.WriteMapNullValue);
    System.out.println(str) ;

编译器提示未找到SerializerFeature,fastjson2是不支持SerializerFeature吗?【提问25】

原提问者GitHub用户1506085843

展开
收起
后端老大 2023-04-21 11:02:51 1497 分享 版权
1 条回答
写回答
取消 提交回答
  • com.alibaba.fastjson.serializer.SerializerFeature -> com.alibaba.fastjson2.JSONReader.Feature

    https://github.com/alibaba/fastjson2/wiki/fastjson_1_upgrade_cn

    原回答者GitHub用户wenshao

    2023-04-21 14:05:51
    赞同 展开评论
问答分类:
问答地址: