diff --git a/src/main/java/com/eactive/ext/kjb/ums/EmailJob.java b/src/main/java/com/eactive/ext/kjb/ums/EmailJob.java index 2366639..1c83c55 100644 --- a/src/main/java/com/eactive/ext/kjb/ums/EmailJob.java +++ b/src/main/java/com/eactive/ext/kjb/ums/EmailJob.java @@ -11,6 +11,7 @@ import com.eactive.ext.kjb.eai.KjbEaiBatchModule; import com.eactive.ext.kjb.safedb.KjbSafedbWrapper; import com.google.gson.Gson; import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; import com.google.gson.JsonObject; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -242,12 +243,14 @@ public class EmailJob { Gson gson = new Gson(); String message = messageRequest.getMessage(); + JsonArray jsonArray = new JsonArray(); log.debug("Template string to json: {}", message); if (StringUtils.isNotEmpty(message)) { JsonObject contentJSon = gson.fromJson(message, JsonObject.class); contentJSon.entrySet().forEach(entry -> { jsonObject.add(entry.getKey(), entry.getValue()); }); + jsonArray.add(jsonObject); } // jsonObject.addProperty("SUBJECT", messageRequest.getSubject()); @@ -255,7 +258,7 @@ public class EmailJob { String jsonString; if (isPretty) { - jsonString = new GsonBuilder().setPrettyPrinting().create().toJson(jsonObject); + jsonString = new GsonBuilder().setPrettyPrinting().create().toJson(jsonArray); } else { jsonString = jsonObject.toString(); }