list转为json

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;
    }
posted @ 2017-09-30 21:54  亮亮的繁星相随  阅读(258)  评论(0编辑  收藏  举报