Skip to content
JSON Tidy
JSON errors

Unrecognized field, not marked as ignorable

Updated by John Marshall

Jackson read a field from the JSON that has nowhere to go in your Java class, and by default Jackson 2 treats that as an error. The message names the field and the class, then lists the properties Jackson does know about. Comparing the two usually shows the problem: the JSON has an extra field you don’t need, the field is spelled differently in the JSON, or your class has the field but Jackson can’t see it.

Quick fix

  1. Find the field and the class in the message, and compare the field with the “known properties” list after it.
  2. If you don’t need the field, add @JsonIgnoreProperties(ignoreUnknown = true) to the class.
  3. If the field should be read, match the name with @JsonProperty, or give the property a getter and setter so Jackson can see it.

Reading the message

Here an API added a middleName field that the User class doesn’t have:

public class User {
    public String firstName;
    public String lastName;
}

String json = """
    {"firstName": "Maya", "lastName": "Chen", "middleName": "Li"}
    """;
User user = new ObjectMapper().readValue(json, User.class);

Jackson stops with this exception:

com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException:
Unrecognized field "middleName" (class com.example.User), not marked as ignorable
(2 known properties: "lastName", "firstName"])
 at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1, column: 58]
 (through reference chain: com.example.User["middleName"])
  • Unrecognized field "middleName" is the field from the JSON.
  • (class com.example.User) is the class Jackson was filling in when it found it.
  • 2 known properties lists every name Jackson would have accepted. The stray ]) at the end is just how Jackson prints the list.
  • The reference chain shows where the field was. For a nested object it gives the full path. This one means the email field of the first user in the data list:
(through reference chain: com.example.Page["data"]->java.util.ArrayList[0]->com.example.User["email"])

Since Jackson 2.16, the message leaves out the JSON itself and says REDACTED instead, so that private data doesn’t end up in logs. The line and column are still there.

Ignoring fields you don’t need

APIs add fields all the time, and a client that breaks every time one appears isn’t much use. If your code doesn’t need middleName, tell Jackson to skip unknown fields for that class:

@JsonIgnoreProperties(ignoreUnknown = true)
public class User {
    public String firstName;
    public String lastName;
}

Or turn the check off for everything the mapper reads:

// Jackson 2
ObjectMapper mapper = new ObjectMapper()
    .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);

The trade-off is that a typo stops being an error too. If your class says fristName, the real firstName is skipped and the field stays null, with nothing to tell you why. Ignoring unknown fields per class, on classes that read other people’s APIs, keeps that risk small.

Spring Boot and Jackson 3. Spring Boot 3 already turns this check off in the ObjectMapper it sets up, and Jackson 3, which Spring Boot 4 uses, turns it off by default. If you get this error in a Spring app anyway, look for code that creates its own new ObjectMapper() instead of using the one Spring provides, or for spring.jackson.deserialization.fail-on-unknown-properties=true in your configuration.

When the field is there under another name

If the message says Unrecognized field "first_name" and the known properties include "firstName", the data is there but the names don’t match. Map each name with @JsonProperty:

public class User {
    @JsonProperty("first_name")
    public String firstName;

    @JsonProperty("last_name")
    public String lastName;
}

If the whole API uses snake_case, set a naming strategy once instead of annotating every field. In Spring Boot, the property spring.jackson.property-naming-strategy=SNAKE_CASE does the same:

ObjectMapper mapper = new ObjectMapper()
    .setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE);

When your class has the field but Jackson can’t see it

Jackson finds properties through public fields, getters and setters. A private field with neither is invisible to it, so this class has no known properties at all:

public class User {
    private String firstName; // no getter or setter, so Jackson can't see it
}

The message gives this away with (0 known properties: ]). Add a getter and setter, use Lombok’s @Getter and @Setter, or put @JsonProperty on the field.

Booleans have a catch of their own. For a field called isActive with the usual isActive() getter, Jackson drops the “is” and names the property active. JSON that says "isActive" then fails with (one known property: "active"]). Lombok generates the same getter, so it has the same problem. Name the property on the getter:

public class Account {
    private boolean isActive;

    @JsonProperty("isActive")
    public boolean isActive() { return isActive; }

    public void setActive(boolean active) { isActive = active; }
}

That reads "isActive", and writes it back out under the same name.

Related Jackson errors

Once the names line up, a value can still have the wrong shape for its field, like an object where your class expects a list. That’s Cannot deserialize value of type. If Jackson can’t create the class in the first place, see Cannot construct instance. To check which fields a response actually has before you write the class, open it in the JSON viewer. For the full list of switches, see the deserialization features page.

The same error elsewhere

Jackson 2.16 and laterUnrecognized field "middleName" (class com.example.User), not marked as ignorable (2 known properties: "lastName", "firstName"])
Jackson before 2.16Unrecognized field "middleName" … at [Source: (String)"{"firstName": "Maya", …"; line: 1, column: 58]
Spring MVCJSON parse error: Unrecognized field "middleName" (class com.example.User), not marked as ignorable
C#, System.Text.Json (strict mode)The JSON property 'middleName' could not be mapped to any .NET member contained in type 'User'.
Python, Pydantic (extra="forbid")Extra inputs are not permitted