public static JSONObject getSubNodeJson(List<Person> nodes) {
JsonConfig jsonConfig = new JsonConfig();
JSONObject json = new JSONObject();
//字段过滤器
jsonConfig.setJsonPropertyFilter(new PropertyFilter() {
@Override
public boolean apply(Object source, String name, Object value) {
System.out.println(name);
if (source != null) {
if (name.equals("birthday") || name.equals("operaMap")) {
return true;
}
}
return false;
}
});
json.put("data", JSONArray.fromObject(nodes, jsonConfig));
return json;
}
JsonConfig jsonConfig = new JsonConfig();
JSONObject json = new JSONObject();
//字段过滤器
jsonConfig.setJsonPropertyFilter(new PropertyFilter() {
@Override
public boolean apply(Object source, String name, Object value) {
System.out.println(name);
if (source != null) {
if (name.equals("birthday") || name.equals("operaMap")) {
return true;
}
}
return false;
}
});
json.put("data", JSONArray.fromObject(nodes, jsonConfig));
return json;
}