List轉Json
List<Student> students = new ArrayList();
String str = JSON.toJSONString(students); // List轉json
Json 轉List 方法一
String json = ""; //獲取的Json數據
List<Student> students = JSON.parseObject(json,new TypeReference<List<Student>>(){}); // Json 轉List
Json 轉List方法二
List<Student> students = JSON.parseArray(json,Student.class);
Student 對象要實現Serializable接口
import java.io.Serializable;
public class Student implements Serializable{
...
}