From 62d682fbd50221988074b1cb7e7b7812212cce34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AF=BB=E9=92=93?= <38355949+dudiao@users.noreply.github.com> Date: Wed, 31 Aug 2022 23:15:04 +0800 Subject: [PATCH] fix: When you append a string to the workflow context, the value has multiple double quotes.(#307) --- .../main/java/tech/powerjob/common/serialize/JsonUtils.java | 6 ++++++ 1 file changed, 6 insertions(+) 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 ef591aee..f68bdc6d 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 class JsonUtils { } public static String toJSONStringUnsafe(Object obj) { + if (obj instanceof String) { + return (String) obj; + } try { return objectMapper.writeValueAsString(obj); }catch (Exception e) {