// 進行json的屬性過濾 PropertyFilter filter = new PropertyFilter() { @Override public boolean apply(Object arg0, String fieldName, Object arg2) { if ("cusPhone".equalsIgnoreCase(fieldName)) { return false; } if ("id".equalsIgnoreCase(fieldName)) { return false; } if ("orders".equalsIgnoreCase(fieldName)) { return false; } return true; } }; // 將集合轉化成json格式 String json = JSONArray.toJSONString(pageBean, filter, SerializerFeature.DisableCircularReferenceDetect);