VNBear commented on code in PR #974:
URL: 
https://github.com/apache/incubator-eventmesh/pull/974#discussion_r910575323


##########
eventmesh-registry-plugin/eventmesh-registry-zookeeper/src/main/java/org/apache/eventmesh/registry/zookeeper/util/JsonUtils.java:
##########
@@ -0,0 +1,26 @@
+package org.apache.eventmesh.registry.zookeeper.util;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class JsonUtils {
+
+    public static String toJSON(Object o) {
+        ObjectMapper objectMapper = new ObjectMapper();
+        try {
+            return objectMapper.writeValueAsString(o);
+        } catch (JsonProcessingException e) {
+            return null;
+        }
+    }
+
+    public static <T> T parseJson(String json, Class<T> c) {
+        ObjectMapper objectMapper = new ObjectMapper();
+        try {
+
+            return objectMapper.readValue(json, c);
+        } catch (JsonProcessingException e) {
+            return null;
+        }

Review Comment:
   tks, i will be  optimize



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to