直接上代码:
String resultStr = JSONArray.toJSONString(response.getData());
JSONArray jsonArray = JSONObject.parseArray(resultStr);
List<T> dataContent = jsonArray.toJavaList(T.class);
先将返回的JSONArray转为JSONString,再通过JSONObject.parseArray(resultStr)转为JSONArray对象,最后通过JSONArray的toJavaList转为我们想要的数据