Json返回过滤null属性

来源:互联网 发布:dota2无法连接网络 编辑:程序博客网 时间:2024/06/06 01:55

返回Json数据时,经常会遇到一个属性为null,需要过滤的情况。
可以在实体类上加上这个注解即可过滤
@JsonInclude(JsonInclude.Include.NON_NULL)

如:

@Entity@JsonInclude(JsonInclude.Include.NON_NULL)@Table(name = "MKC_Group_Comment")public class Comment {   ………………}
原创粉丝点击