JSON Errors / Java

com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException

How to Fix: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException

Jackson found a field in the JSON that has no matching property in your Java class - and by default it treats that as an error rather than ignoring it. The message names the field and the target class: "Unrecognized field 'nickname' ... not marked as ignorable".

This strictness is a feature: it catches typos and schema drift. But for APIs that add fields over time (most of them), you usually want unknown fields ignored deliberately.

{"find": "error"}paste your JSON below

Common causes

1. The API added a new field

The most common cause in production: the service starts returning an extra field and every consumer with default Jackson settings starts throwing.

2. Name mismatch between JSON and Java

The JSON says "user_name" but your class has userName with no @JsonProperty mapping and no naming strategy - Jackson sees an unknown field AND leaves your field null.

Invalid
// JSON: {"user_name": "ada"}
private String userName; // unmapped -> UnrecognizedPropertyException
Valid
@JsonProperty("user_name")
private String userName;

3. Deserializing the wrong class

Pointing readValue() at a class for a different payload shape - e.g. parsing an error response into your success DTO.

How to fix it

Ignore unknown fields on one class
@JsonIgnoreProperties(ignoreUnknown = true)
public class User {
    private String name;
    // ...
}
Or configure the ObjectMapper globally
ObjectMapper mapper = new ObjectMapper()
    .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
Map mismatched names instead of ignoring them
// If the "unknown" field is really a naming mismatch, fix the mapping:
ObjectMapper mapper = new ObjectMapper()
    .setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE);

Frequently asked questions

Should I always set FAIL_ON_UNKNOWN_PROPERTIES to false?

For clients consuming third-party APIs, yes - providers add fields without notice and your client should tolerate that. For servers validating incoming requests, keeping it strict catches malformed clients early. Decide per direction, not globally out of habit.

Ignoring unknowns hid a typo and now my field is null. How do I catch that?

That is the trade-off of ignoreUnknown. Guard the other side: mark truly required fields with @JsonProperty(required = true) (checked for creator properties), validate DTOs after binding (Bean Validation @NotNull), or add a test that deserializes a real payload sample.

What is the Spring Boot behavior?

Spring Boot auto-configures Jackson with FAIL_ON_UNKNOWN_PROPERTIES disabled by default, so REST clients usually do not see this exception until they build a plain ObjectMapper by hand - which is why it often appears when moving code out of Spring.

Last updated:

Related JSON errors

You might also need

Free and in-browser, like everything on JSON Console. Browse all tools →