Jackson with JSON: Unrecognized field, not marked as ignorable Jackson with JSON: Unrecognized field, not marked as ignorable java java

Jackson with JSON: Unrecognized field, not marked as ignorable


You can use Jackson's class-level annotation:

import com.fasterxml.jackson.annotation.JsonIgnoreProperties@JsonIgnorePropertiesclass { ... }

It will ignore every property you haven't defined in your POJO. Very useful when you are just looking for a couple of properties in the JSON and don't want to write the whole mapping. More info at Jackson's website. If you want to ignore any non declared property, you should write:

@JsonIgnoreProperties(ignoreUnknown = true)


You can use

ObjectMapper objectMapper = getObjectMapper();objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);

It will ignore all the properties that are not declared.


The first answer is almost correct, but what is needed is to change getter method, NOT field -- field is private (and not auto-detected); further, getters have precedence over fields if both are visible.(There are ways to make private fields visible, too, but if you want to have getter there's not much point)

So getter should either be named getWrapper(), or annotated with:

@JsonProperty("wrapper")

If you prefer getter method name as is.