Jackson版:
/*** Jackson 配置类 对Json数据进行特殊处理** @Author YangXuyue* @Date 2019/04/02 07:12*/ @Configuration public class JacksonConfig {/*** 配置Jackson** @param builder* @return* @Author YangXuyue* @Date 2019/04/02 07:14*/@Bean@Primary@ConditionalOnMissingBean(ObjectMapper.class)public ObjectMapper jacksonObjectMapper(Jackson2ObjectMapperBuilder builder) {ObjectMapper objectMapper = builder.createXmlMapper(false).build();objectMapper.getSerializerProvider().setNullValueSerializer(new JsonSerializer<Object>() {@Overridepublic void serialize(Object o,JsonGenerator jsonGenerator,SerializerProvider serializerProvider) throws IOException {jsonGenerator.writeString("");}});return objectMapper;} }