JSONArray可以通過JSONArray類的toCollection方法轉換為List。
例如:
JSONArray jsonArray = new JSONArray("[1, 2, 3, 4, 5]"); List<Integer> list = jsonArray.toCollection(ArrayList::new);
在上面的示例中,將JSONArray對象轉換為ArrayList類型的List。