SimplePropertyPreFilter simplePropertyPreFilter = new SimplePropertyPreFilter(); simplePropertyPreFilter.getExcludes().add("creator"); simplePropertyPreFilter.getExcludes().add("createDate"); simplePropertyPreFilter.getExcludes().add("lastModifier"); simplePropertyPreFilter.getExcludes().add("lastModifierName"); JSONArray titleArray = new JSONArray(); for (TitleInfo titleInfo : titleInfoList) { JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(titleInfo,simplePropertyPreFilter)); map.put("titleid", titleInfo.getId()); List<BankOptionsItem> itemList = bankOptionsItemExService.getRandomOptionsItem(titleInfo.getId()); JSONArray jsonArray = JSONArray.parseArray(JSON.toJSONString(itemList,simplePropertyPreFilter)); jsonObject.put("itemList", jsonArray); titleArray.add(jsonObject); }
ValueFilter simpleValueFilter = new ValueFilter() { @Override public Object process(Object object, String name, Object value) { if("attendanceDate".equals(name)){ return DateFormatUtils.format((Long) value, "yyy-MM-dd HH:mm:ss"); } return value; } };
JSONArray jsonArray = JSONArray.parseArray(JSON.toJSONString(infoList));