//list轉換爲json json
Gson gson = new Gson(); ui
List<Person> persons = new ArrayList<Person>(); spa
String str = gson.toJson(persons);.net
//json轉換爲list blog
Gson gson = new Gson(); get
List<Person> persons = gson.fromJson(str, new TypeToken<List<Person>>(){}.getType());it
//list轉換爲json ast
List<CustPhone> list = new ArrayList<CustPhone>(); class
String str=JSON.toJSON(list).toString();List
//json轉換爲list
List<Person> list = new ArrayList<Person>();
list = JSONObject.parseArray(jasonArray, Person.class);
參考:
http://blog.csdn.net/demonliuhui/article/details/52949079
http://blog.csdn.net/qxs965266509/article/details/42774691
http://huyizizhen.iteye.com/blog/1453621
http://blog.csdn.net/u010797575/article/details/43304981
http://blog.csdn.net/paincupid/article/details/51221391