使用Jackson的方式:
            
            
              java
              
              
            
          
          //第一种方式,使用@JsonIgnore注解标注在属性上,忽略指定属性
public  class PropertyDTO {
    @JsonProperty("disable")
    private Integer disable;
    @JsonProperty("placeholder")
    private String placeholder;
	//使用@JsonIgnore注解,忽略此属性,前端不会拿到该属性
    @JsonIgnore
    private String validate;
}
//第二种方式,使用@JsonIgnoreProperties标注在类上,可以忽略指定集合的属性
@JsonIgnoreProperties({"validate"})
public  class PropertyDTO {
    @JsonProperty("disable")
    private Integer disable;
    @JsonProperty("placeholder")
    private String placeholder;
    private String validate;
}
        注意点:
            
            
              java
              
              
            
          
          public  class PropertyDTO {
    @JsonProperty("disable")
    private Integer disable;
    @JsonProperty("placeholder")
    private String placeholder;
	@JsonProperty("validate")
    @JsonIgnore
    private String validate;
}
        同时使用@JsonProperty和@JsonIgnore时,可能会导致@JsonIgnore失效,前端依旧拿到该属性。
使用fastjson时 :
使用@JSONField(serialize = false)注解