@JsonSerialize ( include = JsonSerialize .Inclusion. NON_NULL ) //When json is serialized, if it is a null object , the key will disappear public class PicUploadResult { // The judgment flag of whether the upload is successful, 0- success, 1- failure private Integer error ; private String url ; private String message ; @JsonIgnore // make it not in the json serialization result private String width ; @JsonIgnore private String height; public PicUploadResult(){ } public Integer getError() { return error; } public void setError(Integer error) { this.error = error; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public String getWidth() { return width; } public void setWidth(String width) { this.width = width; } public String getHeight() { return height; } public void setHeight(String height) { this.height = height; } }
Serialization in jackson is the use of annotations in Json
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=324540383&siteId=291194637
Recommended
Ranking