Jackson with JSON: Unrecognized field, not marked as ignorable

You can use Jackson’s class-level annotation:

import com.fasterxml.jackson.annotation.JsonIgnoreProperties

@JsonIgnoreProperties
class { ... }

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)

Leave a Comment