I'm using jackson-xxx 2.8.5.Maven Dependency like:
<dependencies>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.8.5</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.8.5</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.8.5</version>
</dependency>
</dependencies>
First,If you want ignore unknown properties globally.you can config ObjectMapper
.
Like below:
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
If you want ignore some class,you can add annotation @JsonIgnoreProperties(ignoreUnknown = true)
on your class like:
@JsonIgnoreProperties(ignoreUnknown = true)
public class E1 {
private String t1;
public String getT1() {
return t1;
}
public void setT1(String t1) {
this.t1 = t1;
}
}