diff --git a/core/src/main/java/com/rudderstack/android/sdk/core/util/Utils.java b/core/src/main/java/com/rudderstack/android/sdk/core/util/Utils.java index 2863551ce..4125aea1d 100644 --- a/core/src/main/java/com/rudderstack/android/sdk/core/util/Utils.java +++ b/core/src/main/java/com/rudderstack/android/sdk/core/util/Utils.java @@ -95,7 +95,12 @@ public static String getDeviceId(Application application) { } public static Map convertToMap(Object obj) { - String json = RudderGson.serialize(obj); + String json; + if (obj instanceof String) { + json = (String) obj; + } else { + json = RudderGson.serialize(obj); + } if (json == null) { return new HashMap<>(); } @@ -108,7 +113,13 @@ public static Map convertToMap(Object obj) { public static List> convertToList(Object obj) { - String json = RudderGson.serialize(obj); + String json; + if (obj instanceof String) { + json = (String) obj; + } else { + json = RudderGson.serialize(obj); + } + if (json == null) { return new ArrayList<>(); }