EricPyZhou commented on issue #6072:
URL:
https://github.com/apache/dolphinscheduler/issues/6072#issuecomment-922606441
@ruanwenjun @zhuangchong By my own test method:
```
@Test
public void simpleTest() {
String sqlResult = "{\"id\":[],\"test1\":\"7\"}";
// first way
Map<String, Object> param = JSONUtils.parseObject(sqlResult, new
TypeReference<Map<String, Object>>() {});
System.out.println(param + " " +param.getClass().getSimpleName());
param.forEach((key, value) -> System.out.println(value + " " +
value.getClass().getSimpleName()));
// second way
Map<String, Object> param2 = JSONUtils.toMap(sqlResult,
String.class, Object.class);
System.out.println(param2 + " " +param2.getClass().getSimpleName());
param.forEach((key, value) -> System.out.println(value + " " +
value.getClass().getSimpleName()));
}
```
There is no difference in between when dealing with such hashmap, and I saw
alot of code written as the **second** way, for example in
[ExecutorServiceImpl.java](https://github.com/apache/dolphinscheduler/blob/69a153c5f5c9d91b4eececbcfbf9e2fb407f89c4/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java#L273)
Shall I remove this method (toMap(String json, Class<K> classK, Class<V>
classV)) and replace it with parseObject as in the **first** way?
--
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]