FastJson/FastJson2小技巧——序列化NULL<欢迎评论收藏交流>

常见:使用fastjson进行需要处理,比如字段为null依然序列化问题。那么fastjson的@JSONField就能很好的解决这些问题。

//fastjson2 设置参数为null时参与序列化
@JSONField(serializeFeatures = JSONWriter.Feature.WriteMapNullValue)
private String userPhone;
//fastjson 设置参数为null时参与序列化
@JSONField(serialzeFeatures = SerializerFeature.WriteMapNullValue)
private String userPhone;

猜你喜欢

转载自blog.csdn.net/weixin_40097029/article/details/126181176