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.
| Runtime | Message | Input and evidence |
|---|---|---|
| Java / Jackson 2.x | UnrecognizedPropertyException: 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.x | Unrecognized property "fullName" (class com.example.User), not marked as ignorable | The same input, with FAIL_ON_UNKNOWN_PROPERTIES enabledJackson 3.2.3 source template; known-properties suffix omitted |
| Spring MVC | JSON parse error: Unrecognized field "fullName" (class com.example.User), not marked as ignorable | A mapper with the check enabledSpring Framework 7.0.9 prefix; Spring-built mappers disable the check by default |
| C# / System.Text.Json | The JSON property '{0}' could not be mapped to any .NET member contained in type '{1}'. | JsonUnmappedMemberHandling.DisallowOfficial .NET 10 resource template; this check is off by default |
| Go / Decoder.DisallowUnknownFields | json: unknown field "fullName" | The same input in GoOfficial 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.
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 ignorableJSON uses snake_case and Java uses camelCase
first_name does not match a firstName component. Map the name or change the naming strategy.
record Person(String firstName) {}
new ObjectMapper().readValue("{\"first_name\":\"Ada\"}", Person.class);
// Unrecognized field "first_name" (class Person), not marked as ignorableThe 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.
record Repo(String name) {}
new ObjectMapper().readValue("{\"name\":\"tools\",\"stars\":12}", Repo.class);
// Unrecognized field "stars" (class Repo), not marked as ignorableHow to fix it
- Read the field name and the class. The known-properties list in the message shows what Jackson can map.
- Compare it with your class: a new field to add, a naming mismatch to map, or extra data to ignore.
- Prefer explicit mapping with @JsonProperty. Ignore unknown properties per class with @JsonIgnoreProperties(ignoreUnknown = true) when the class reads only part of an external document.
- 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.
record Person(@JsonProperty("first_name") String firstName, String email) {}Ignore unknown properties for one class
The rest of your mappers stay strict.
@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.
ObjectMapper mapper = JsonMapper.builder()
.propertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE)
.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
.build();Compare the JSON shape with your types
- Copy the exact JSON your code received, for example from a log or a failing test.
- Paste it into the Tool Kumar JSON viewer. The document stays in your browser.
- 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.
- 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.
Related errors and tools
- Jackson: Cannot deserialize value of type from Array or Object value
- Jackson: Unrecognized token / Unexpected character ('<' (code 60))
- Go JSON: cannot unmarshal string, object or array into Go value
- All JSON error guides
- JSON syntax reference
- Generate Java records with @JsonProperty mappings from the JSON
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.