SnowMoon-Dev commented on code in PR #10817:
URL: https://github.com/apache/dolphinscheduler/pull/10817#discussion_r915399065
##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/java/org/apache/dolphinscheduler/api.test/utils/JSONUtils.java:
##########
@@ -381,4 +383,27 @@ public String deserialize(JsonParser p,
DeserializationContext ctxt) throws IOEx
public static <T> T convertValue(Object value, Class<T> targetType) {
return objectMapper.convertValue(value, targetType);
}
+
+ /**
+ * jsonToObject
+ *
+ * @param json
+ * @param path json object access path
+ * @param objectType
+ * @param <T>
+ * @return
+ */
+ public static <T> T jsonToObject(String json, String path, Class<T>
objectType) {
+ return JsonPath.from(json).getObject(path, objectType);
+ }
+
+
+ public static <T> List<T> jsonToObjectList(String json, String path,
Class<T> objectType) {
+ return JsonPath.from(json).getList(path, objectType);
+ }
+
+
+ public static Map<String, Object> jsonToMap(String json, String path) {
+ return JsonPath.from(json).getObject(path, new TypeRef<Map<String,
Object>>() {});
+ }
Review Comment:
Although these three methods are not currently used in the demo, they will
be used later
--
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]