分享好友模块
This commit is contained in:
@@ -88,6 +88,18 @@ public class JSONUtil {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static <T> List<T> parseJSONStrTList(String jsonStr, Class<T> clazz) {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
try {
|
||||
// 将JSON字符串转换为List<T>
|
||||
return objectMapper.readValue(jsonStr, objectMapper.getTypeFactory().constructCollectionType(List.class, clazz));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param list 某集合
|
||||
* @param clazz 要转成的实体
|
||||
|
||||
Reference in New Issue
Block a user