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
简要描述您碰到的问题。 序列化 map 还是为null config.setWriterFeatures( JSONWriter.Feature.NullAsDefaultValue) map返回为null "map": null,
请填写以下信息:
springboot 2.6.3
@Bean public FastJsonHttpMessageConverter fastJsonHttpMessageConverter() { FastJsonHttpMessageConverter messageConverter = new FastJsonHttpMessageConverter(); FastJsonConfig config = messageConverter.getFastJsonConfig(); config.setReaderFeatures(JSONReader.Feature.FieldBased, JSONReader.Feature.SupportArrayToBean); config.setDateFormat("yyyy-MM-dd HH:mm:ss"); config.setWriterFeatures( JSONWriter.Feature.PrettyFormat , JSONWriter.Feature.NullAsDefaultValue ); messageConverter.setFastJsonConfig(config); messageConverter.setDefaultCharset(StandardCharsets.UTF_8); messageConverter.setSupportedMediaTypes(Collections.singletonList(MediaType.APPLICATION_JSON)); return messageConverter; }
对您期望发生的结果进行清晰简洁的描述。 不应该为 "map": {} 的嘛
The text was updated successfully, but these errors were encountered:
现在当存在NullAsDefaultValue是,WriteNulls值是自动生效的
Sorry, something went wrong.
@wenshao WriteNulls值是自动生效的 , 那map为空时,输出 "map": null, 和 "map": {} 哪个是预期值呢?
bug fix for WriteNulls check, issue #372
872f5bf
https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.6-SNAPSHOT/
问题已经修复,请帮忙用2.0.6-SNAPSHOT版本验证,2.0.6正式版预计6月5日前发布
https://github.com/alibaba/fastjson2/releases/tag/2.0.6 问题已经修复,请用新版本
No branches or pull requests
问题描述
简要描述您碰到的问题。
序列化 map 还是为null
config.setWriterFeatures( JSONWriter.Feature.NullAsDefaultValue)
map返回为null "map": null,
环境信息
请填写以下信息:
springboot 2.6.3
期待的正确结果
对您期望发生的结果进行清晰简洁的描述。
不应该为 "map": {} 的嘛
The text was updated successfully, but these errors were encountered: