-
默认舍去value为null的字段
默认:
JSON.toJSONString(zhangsan)
输出值为null的字段:
JSON.toJSONString(zhangsan, SerializerFeature.WriteMapNullValue)
输出值为null的字段(字符串类型为null的输出空字符串:"",会导致 ""和null并存,解决见 fastjaon 问答):
JSON.toJSONString(zhangsan, SerializerFeature.WriteMapNullValue, SerializerFeature.WriteNullStringAsEmpty)