1.@JsonInclude(Include.NON_NULL)
2.用注解的方式放在标记类或者属性
package com.tj.exam.model;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
@JsonInclude(Include.NON_NULL)
public class ResultDto implements java.io.Serializable {
private static final long serialVersionUID = 893558162857219292L;
private List<? extends Object> data;
private String resultType;
private String message;
private String resultCode;
private int total;
private Map<String, ? extends Object> map;
private List<? extends Object> dataTwo;
}