When using the objectmapper on an object you can run into Unrecognized field “”. This is due to the field not being found.
![How to fix java Unrecognized field when using objectmapper](https://mlwhtpbnv3vw.i.optimole.com/w:695/h:67/q:mauto/ig:avif/https://spacetech.dk/wp-content/uploads/2022/12/image-11.png)
You can use an easy annotation to ignore every property you haven’t defined in your json string. This is very useful if you are only looking for a couple of properties in the json. This will only get what you ned and won’t write the whole mapping. Use the @JsonIgnoreProperties annotation and set ignoreUnknown to true.
@JsonIgnoreProperties(ignoreUnknown = true)
public Class MyObject {
private String name;
}
More information in the source: https://github.com/FasterXML/jackson-annotations