We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) { FastJsonConfig fastJsonConfig = new FastJsonConfig(); fastJsonConfig.setWriterFeatures( JSONWriter.Feature.WriteLongAsString ); fastJsonConfig.setReaderFeatures( JSONReader.Feature.IgnoreSetNullValue, JSONReader.Feature.TrimString, JSONReader.Feature.IgnoreNullPropertyValue, JSONReader.Feature.IgnoreNoneSerializable, JSONReader.Feature.NullOnError ); FastJsonHttpMessageConverter fastConverter = new FastJsonHttpMessageConverter(); fastConverter.setFastJsonConfig(fastJsonConfig); fastConverter.setSupportedMediaTypes(Collections.singletonList(MediaType.APPLICATION_JSON)); converters.add(0, fastConverter); } 需要一个ReaderFeature, 值为空字符串("")时,也不进行Set操作,忽略该属性,应该怎么添加。 PropertyFilter ignoreEmpty = (object, name, value) -> !"".equals(value); fastJsonConfig.setReaderFilters(ignoreEmpty); 这种方法不生效
The text was updated successfully, but these errors were encountered:
环境 JDK1.8 版本 2.0.47 输入{"a":""} 期望结果 a:null
Sorry, something went wrong.
https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.48-SNAPSHOT/ 新增加了Feature.EmptyStringAsNull,请帮忙用2.0.48-SNAPSHOT版本帮忙验证,2.0.48版本预计在3月底前发布。
https://github.com/alibaba/fastjson2/releases/tag/2.0.48 请用新版本
No branches or pull requests
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
FastJsonConfig fastJsonConfig = new FastJsonConfig();
fastJsonConfig.setWriterFeatures(
JSONWriter.Feature.WriteLongAsString
);
fastJsonConfig.setReaderFeatures(
JSONReader.Feature.IgnoreSetNullValue,
JSONReader.Feature.TrimString,
JSONReader.Feature.IgnoreNullPropertyValue,
JSONReader.Feature.IgnoreNoneSerializable,
JSONReader.Feature.NullOnError
);
FastJsonHttpMessageConverter fastConverter = new FastJsonHttpMessageConverter();
fastConverter.setFastJsonConfig(fastJsonConfig);
fastConverter.setSupportedMediaTypes(Collections.singletonList(MediaType.APPLICATION_JSON));
converters.add(0, fastConverter);
}
需要一个ReaderFeature, 值为空字符串("")时,也不进行Set操作,忽略该属性,应该怎么添加。
PropertyFilter ignoreEmpty = (object, name, value) -> !"".equals(value);
fastJsonConfig.setReaderFilters(ignoreEmpty);
这种方法不生效
The text was updated successfully, but these errors were encountered: