导入包: import com.fasterxml.jackson.annotation.JsonInclude; 在字段上加上注解: @JsonInclude(JsonInclude.Include.NON_EMPTY)