百度发现有个filter 方法 SimplePropertyPreFilter

 

SimplePropertyPreFilter filter = new SimplePropertyPreFilter();
filter.getExcludes().add("name");
filter.getExcludes().add("weight");
filter.getExcludes().add("sex");


return ApiResult.success(JSONObject.parse(JSONObject.toJSONString(poJo , filter, SerializerFeature.WriteMapNullValue)));