参考:Jackson序列化(7) —使用BeanSerializerModifier定义Jackson的序列化方式(对于null,String格式要返回"") - 简书
模块:blade-core-tool
类:BladeBeanSerializerModifier
在这个类中,对null的整型序列化为-1。
public interface NullJsonSerializers {
JsonSerializer<Object> STRING_JSON_SERIALIZER = new JsonSerializer<Object>() {
public void serialize(Object value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
gen.writeString("");
}
};
JsonSerializer<Object> NUMBER_JSON_SERIALIZER = new JsonSerializer<Object>() {
public void serialize(Object value, JsonGenerator gen, SerializerPr