我有一類叫做如何爲列表創建JSONArray <Class name>
class Student {
String name;
String age;
}
我有一個返回List對象像
public List<Student> getList(){
List<Student> li =new ArrayList();
....
li.add(new Student('aaa','12'));
...
return li;
}
我需要的是列表轉換成JSONArray這樣
的方法[{"name":"sam","age":"12"},{"name":"sri","age":"5"}]
任何人都可以幫助我得到這個嗎?謝謝Advancee ..
+這個答案安全我的晚上。 :) –