JSON troubleshooting

Jackson: Unrecognized field, not marked as ignorable

Fix Jackson UnrecognizedPropertyException: map renamed keys, ignore unknown properties on purpose, and know the Jackson 3 and Spring defaults.

What the error means

The JSON has a property that matches no field, setter or constructor parameter in the target class, and the mapper is set to fail on unknown properties. Jackson 2 fails by default. Jackson 3 changed the default of DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES to false, and Spring's Jackson2ObjectMapperBuilder also turns it off, so the error mostly comes from a plain Jackson 2 ObjectMapper or a mapper that enables the check on purpose. Decide whether the key is a field you should map, a naming mismatch, or data you can ignore.

Exact messages by runtime

Messages depend on the input and runtime version. Node and Python rows were reproduced locally. Other rows cite official documentation or source. Rows marked as fragments or templates preserve the source wording and are not complete exception transcripts. Browsers and libraries may append location details.

RuntimeMessageInput and evidence
Java / Jackson 2.xUnrecognizedPropertyException: Unrecognized field "fullName" (class com.example.User), not marked as ignorable (2 known properties: "name", "email")A fullName key read into record User(String name, String email)
Source-derived from Jackson 2.22; location and reference chain omitted, property order can differ
Java / Jackson 3.xUnrecognized property "fullName" (class com.example.User), not marked as ignorableThe same input, with FAIL_ON_UNKNOWN_PROPERTIES enabled
Jackson 3.2.3 source template; known-properties suffix omitted
Spring MVCJSON parse error: Unrecognized field "fullName" (class com.example.User), not marked as ignorableA mapper with the check enabled
Spring Framework 7.0.9 prefix; Spring-built mappers disable the check by default
C# / System.Text.JsonThe JSON property '{0}' could not be mapped to any .NET member contained in type '{1}'.JsonUnmappedMemberHandling.Disallow
Official .NET 10 resource template; this check is off by default
Go / Decoder.DisallowUnknownFieldsjson: unknown field "fullName"The same input in Go
Official Go 1.27 source; this check is off by default

Causes you can reproduce

The API added or renamed a field

Old code meets new JSON. If the field is useful, add it to the class; if it was renamed, map the new name.

JAVA
record User(String name, String email) {}

new ObjectMapper().readValue(
    "{\"name\":\"Ada\",\"email\":\"ada@example.com\",\"fullName\":\"Ada Lovelace\"}", User.class);
// Unrecognized field "fullName" (class User), not marked as ignorable

JSON uses snake_case and Java uses camelCase

first_name does not match a firstName component. Map the name or change the naming strategy.

JAVA
record Person(String firstName) {}

new ObjectMapper().readValue("{\"first_name\":\"Ada\"}", Person.class);
// Unrecognized field "first_name" (class Person), not marked as ignorable

The JSON carries data the class does not need

A class that reads a few fields from a large third-party document fails on the first field it does not declare.

JAVA
record Repo(String name) {}

new ObjectMapper().readValue("{\"name\":\"tools\",\"stars\":12}", Repo.class);
// Unrecognized field "stars" (class Repo), not marked as ignorable

How to fix it

  1. Read the field name and the class. The known-properties list in the message shows what Jackson can map.
  2. Compare it with your class: a new field to add, a naming mismatch to map, or extra data to ignore.
  3. Prefer explicit mapping with @JsonProperty. Ignore unknown properties per class with @JsonIgnoreProperties(ignoreUnknown = true) when the class reads only part of an external document.
  4. When you move to Jackson 3, unknown properties are ignored by default. Enable FAIL_ON_UNKNOWN_PROPERTIES where you rely on strict checking.

Map a renamed or snake_case key

The annotation renames one property and leaves the others alone.

JAVA
record Person(@JsonProperty("first_name") String firstName, String email) {}

Ignore unknown properties for one class

The rest of your mappers stay strict.

JAVA
@JsonIgnoreProperties(ignoreUnknown = true)
record Repo(String name) {}

Change the naming strategy or the default for a mapper

Jackson 2 API; PropertyNamingStrategies needs 2.12 or later. Disable the check only for mappers that read documents you do not control.

JAVA
ObjectMapper mapper = JsonMapper.builder()
    .propertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE)
    .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
    .build();

Compare the JSON shape with your types

  1. Copy the exact JSON your code received, for example from a log or a failing test.
  2. Paste it into the Tool Kumar JSON viewer. The document stays in your browser.
  3. Open the tree at the property named in the error and check whether the value there is an object, an array or a single value. The JSON path finder copies the path to any value.
  4. Generate types from the same document with a converter listed under related tools, then compare them with your own classes or structs.

Frequently asked questions

Is it safe to ignore unknown properties?

It is common for clients of external APIs, because new fields then do not break you. It also hides typos and renamed fields, which become silently missing values. Keep the check on for your own contracts and in tests.

Why does my Spring application not throw this?

Spring's Jackson2ObjectMapperBuilder disables FAIL_ON_UNKNOWN_PROPERTIES unless you set it, and Jackson 3 disables it by default. A plain new ObjectMapper() in Jackson 2 still fails.

What changed in Jackson 3?

FAIL_ON_UNKNOWN_PROPERTIES defaults to false, and when you enable it the message says Unrecognized property instead of Unrecognized field.

Why does the error list known properties?

Jackson appends the names it can map so you can spot a naming mismatch, such as firstName against first_name.

Standards and diagnostic sources

RFC 8259 and ECMA-404 define JSON syntax. Diagnostic wording belongs to the parser. The table links each cited message to its source.