Jackson的JSON序列化注解
作者:互联网
package com.example.springboot.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.time.LocalDateTime;
@Data
public class User {
@JsonProperty("username")
private String phone;
@JsonIgnore
private String pwd;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
@JsonInclude(JsonInclude.Include.NON_NULL)
private LocalDateTime createdTime;
}
标签:Jackson,private,JSON,jackson,import,序列化,com,annotation,fasterxml 来源: https://www.cnblogs.com/xl4ng/p/16200525.html