diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/JSONUtils.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/JSONUtils.java index fb417cb64d5b..e0b14a2a2ebc 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/JSONUtils.java +++ b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/JSONUtils.java @@ -37,6 +37,7 @@ import java.util.Collections; import java.util.List; import java.util.Map; +import java.util.HashMap; import java.util.Objects; import java.util.TimeZone; @@ -248,10 +249,21 @@ public static String findValue(JsonNode jsonNode, String fieldName) { * @return json to map */ public static Map toMap(String json) { - return parseObject(json, new TypeReference>() { + Map map = parseObject(json, new TypeReference>() { }); + + if (map == null) { + return Collections.emptyMap(); + } + + Map result = new HashMap<>(); + for (Map.Entry entry : map.entrySet()) { + result.put(entry.getKey(), String.valueOf(entry.getValue())); + } + return result; } + /** * from the key-value generated json to get the str value no matter the real type of value *