import com.fasterxml.jackson.annotation.*; @JsonIgnoreProperties(ignoreUnknown = true) public class Person { @JsonProperty("name") private String fullName; @JsonProperty("age") private int age; @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") private Date birthDate; // Getter and setter methods @Override public String toString() { return "Person{" + "fullName='" + fullName + '\'' + ", age=" + age + ", birthDate=" + birthDate + '}'; } } <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>2.12.4</version> </dependency> groovy implementation 'com.fasterxml.jackson.core:jackson-databind:2.12.4'


上一篇:
下一篇:
切换中文