0
在spring-mvc中配置了fastjson序列化:
<mvc:annotation-driven>
<mvc:message-converters register-defaults="true">
<bean class="com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter">
<property name="supportedMediaTypes">
<list>
<value>application/json;charset=UTF-8</value>
</list>
</property>
<property name="fastJsonConfig">
<bean class="com.alibaba.fastjson.support.config.FastJsonConfig">
<property name="features">
<list>
<value>AllowUnQuotedFieldNames</value>
<value>DisableCircularReferenceDetect</value>
</list>
</property>
<property name="serializerFeatures">
<list>
<!-- 将Collection类型字段的字段空值输出为[] -->
<value>WriteNullListAsEmpty</value>
</list>
</property>
</bean>
</property>
</bean>
</mvc:message-converters>
</mvc:annotation-driven>
导致Date类型的属性null值时,也输出来了,不加这个WriteNullListAsEmpty配置是不输出null字段的。

而WriteNullListAsEmpty 就被包含在 WRITE_MAP_NULL_FEATURES之中