JSONArray可以通过JSONArray类的toCollection方法转换为List。
例如:
JSONArray jsonArray = new JSONArray("[1, 2, 3, 4, 5]");List<Integer> list = jsonArray.toCollection(ArrayList::new);
在上面的示例中,将JSONArray对象转换为ArrayList
JSONArray可以通过JSONArray类的toCollection方法转换为List。
例如:
JSONArray jsonArray = new JSONArray("[1, 2, 3, 4, 5]");List<Integer> list = jsonArray.toCollection(ArrayList::new);
在上面的示例中,将JSONArray对象转换为ArrayList