public class List2Json { public static JSONArray ProLogList2Json(List<ProgramLog> list){ JSONArray json = new JSONArray(); for(ProgramLog pLog : list){ JSONObject jo = new JSONObject(); jo.put("id", pLog.getId()); jo.put("time", pLog.getBeginTime()); json.put(jo); } return json; }
原文:http://www.cnblogs.com/weyine/p/7616255.html