ruanwenjun opened a new issue #6072: URL: https://github.com/apache/dolphinscheduler/issues/6072
**Describe the bug** This method is hope to deserialize a JSON to Map. https://github.com/apache/dolphinscheduler/blob/e866d1be86464d812551e8c38ba60767a204c82e/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/JSONUtils.java#L249-L251 But the generics type in the Map is not what we expected. We can write a simple test case: ```java String sqlResult = "{\"id\":[],\"test1\":\"6\"}"; Map<String, List> param = toMap(sqlResult, String.class, List.class); System.out.println(param); ``` It will execute success, and print ``` {id=[], test1=6} ``` The value type of `id` is `List`, the value type of `test1` is `String`. But If we loop the map, it will throw a exception, because the value in this map has different type ```java String sqlResult = "{\"id\":[],\"test1\":\"6\"}"; Map<String, List> param = toMap(sqlResult, String.class, List.class); param.forEach((key, value) -> System.out.println(value)); ``` ``` [] Exception in thread "main" java.lang.ClassCastException: java.lang.String cannot be cast to java.util.List at java.util.LinkedHashMap.forEach(LinkedHashMap.java:684) at org.apache.dolphinscheduler.common.utils.JSONUtils.main(JSONUtils.java:256) ``` I don't find out the deep reason, but I think we should remove this method. **Which version of Dolphin Scheduler:** -[dev] -- 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]
