[color=green] //list转换成json数组
public static JSONArray list2CtsJSON(List<? extends Object> list) {
JSONArray jsonArray = new JSONArray();
if (list != null && !list.isEmpty()) {
for (Object bean : list) {
jsonArray.add(bean);
}
}
return jsonArray;
}
//Object转换成数据
private static JSONObject bean2JSON(Object bean,String properties)
JSONObject row= new JSONObject();
if (bean!= null && !bean.isEmpty())
{
row.element(properties, bean);
}
}[/color]
public static JSONArray list2CtsJSON(List<? extends Object> list) {
JSONArray jsonArray = new JSONArray();
if (list != null && !list.isEmpty()) {
for (Object bean : list) {
jsonArray.add(bean);
}
}
return jsonArray;
}
//Object转换成数据
private static JSONObject bean2JSON(Object bean,String properties)
JSONObject row= new JSONObject();
if (bean!= null && !bean.isEmpty())
{
row.element(properties, bean);
}
}[/color]