diff --git a/powerjob-common/src/main/java/tech/powerjob/common/serialize/JsonUtils.java b/powerjob-common/src/main/java/tech/powerjob/common/serialize/JsonUtils.java index ef591aee4..f68bdc6da 100644 --- a/powerjob-common/src/main/java/tech/powerjob/common/serialize/JsonUtils.java +++ b/powerjob-common/src/main/java/tech/powerjob/common/serialize/JsonUtils.java @@ -22,6 +22,9 @@ public class JsonUtils { } public static String toJSONString(Object obj) { + if (obj instanceof String) { + return (String) obj; + } try { return objectMapper.writeValueAsString(obj); }catch (Exception ignore) { @@ -30,6 +33,9 @@ public static String toJSONString(Object obj) { } public static String toJSONStringUnsafe(Object obj) { + if (obj instanceof String) { + return (String) obj; + } try { return objectMapper.writeValueAsString(obj); }catch (Exception e) {