diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/config/JacksonConfiguration.java b/blade-core-tool/src/main/java/org/springblade/core/tool/config/JacksonConfiguration.java index e60e4b5..a716598 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/config/JacksonConfiguration.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/config/JacksonConfiguration.java @@ -77,6 +77,8 @@ public class JacksonConfiguration { objectMapper.getDeserializationConfig().withoutFeatures(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); //日期格式化 objectMapper.registerModule(new BladeJavaTimeModule()); + //允许空字符串序列化为null对象 + objectMapper.enable(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT); objectMapper.findAndRegisterModules(); return objectMapper; } diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/jackson/JsonUtil.java b/blade-core-tool/src/main/java/org/springblade/core/tool/jackson/JsonUtil.java index 6b2e030..5759390 100644 --- a/blade-core-tool/src/main/java/org/springblade/core/tool/jackson/JsonUtil.java +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/jackson/JsonUtil.java @@ -976,6 +976,8 @@ public class JsonUtil { super.getDeserializationConfig().withoutFeatures(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); //日期格式化 super.registerModule(new BladeJavaTimeModule()); + //允许空字符串序列化为null对象 + super.enable(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT); super.findAndRegisterModules(); }