Spring Boot + JSON 處理

Spring Boot 之使用 Json 詳解

1. 前臺不顯示屬性的空值:NULL
類上增長註解:@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
2. 先後臺顯示屬性名稱不一致
屬性增長註解:  @JsonProperty("myName")
3. 註解:不顯示屬性
com.fasterxml.jackson.annotation.JsonIgnore
OR
@JSONField(serialize = false)>來自com.alibaba.fastjson.annotation
4. pom.xml增長
<dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-jsr310</artifactId>
        </dependency>
相關文章
相關標籤/搜索