Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Jackson rejects an unrecognized JSON property by default during databind deserialization. To ignore unknown properties, disable DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES at the scope you intend: on a mapper for application-wide behavior, on an ObjectReader for one read, or with @JsonIgnoreProperties(ignoreUnknown = true) on a DTO. Choose based on whether the API should detect contract mismatches, tolerate additive fields, or retain extra input for inspection.

Why Jackson rejects unknown properties

Jackson databind documents FAIL_ON_UNKNOWN_PROPERTIES as enabled by default. When an incoming property has no matching setter and no @JsonAnySetter fallback, Jackson treats it as unknown; with the feature enabled, deserialization can fail with a mapping exception. Disabling the feature makes Jackson skip that property. See the FasterXML deserialization feature reference.

This behavior is useful when an unexpected field may indicate a producer/consumer contract mismatch. It can also make an older consumer reject a newer producer’s otherwise compatible additive change. Ignoring is not automatically safer or more compatible: it means the DTO will not validate, preserve, or act on fields it does not recognize.

Choose the scope that matches the API contract

Approach Scope Behavior and when to choose it
Keep the default strict behavior Where the effective mapper configuration leaves the feature enabled Rejects unhandled unknown properties. Use when unexpected input should surface as contract drift or violate endpoint validation.
Configure an ObjectReader One configured read operation Allows tolerance for a particular integration or operation without changing the mapper’s policy for other reads.
@JsonIgnoreProperties(ignoreUnknown = true) A target DTO type Allows that type to accept unrecognized incoming properties. Use when tolerance is part of the type’s input contract.
Disable the feature on the mapper Reads using that mapper Allows unrecognized properties broadly. Use only when that is a deliberate application-wide rule.
Use an any-setter or explicit tree/model handling The type or parsing path designed to handle extensions Provides a route to inspect or retain extra properties instead of silently discarding them; validation and storage details depend on the application.

Jackson’s documentation describes both per-reader feature configuration and type-level handling; the project repository documents the annotation and mapper-builder configuration. See the jackson-databind repository.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Disable unknown-property failures globally on a mapper

The current repository example uses Jackson 3.x builder style:

ObjectMapper mapper = JsonMapper.builder()
    .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
    .build();

This changes the behavior for deserialization performed with that mapper, so it is broader than a single DTO or operation. Jackson 3.x uses builder-style construction; do not assume configuration code for another Jackson major version is interchangeable. Also check framework-managed mapper configuration and other existing settings before relying on the behavior of a bare mapper.

Allow unknown properties for one read

Use an ObjectReader when one operation needs to accept extra fields but the rest of the application should remain strict. The feature reference documents readers as a way to adjust deserialization features for a read. For example, with a configured mapper:

ObjectReader reader = mapper.readerFor(MyDto.class)
    .without(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
MyDto value = reader.readValue(json);

This keeps the tolerance decision attached to the read path rather than changing the mapper’s general policy. Confirm the reader API against the Jackson version in your application.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Allow unknown properties on one DTO

Annotate the target type when accepting unrecognized input is a property of that DTO’s contract:

@JsonIgnoreProperties(ignoreUnknown = true)
public class PartnerPayload {
    private String id;

    public String getId() { return id; }
    public void setId(String id) { this.id = id; }
}

The annotation allows unknown incoming properties for that class; those properties are skipped, not added to the DTO. The same annotation can name specific properties to ignore, as documented by FasterXML. Prefer named-property handling when the API contract calls for excluding particular fields rather than accepting every unrecognized property.

When ignoring is the wrong behavior

If extra data must be reviewed, retained, or validated, do not switch on silent skipping as a substitute for an extension-data design. Jackson identifies @JsonAnySetter as another handling path for otherwise unknown properties. A tree-based or other explicit model may be more appropriate when the application needs to examine arbitrary JSON. Decide how to validate, store, or log that data without exposing sensitive values through logs.

  • Keep strict rejection when unexpected fields should reveal a producer/consumer mismatch.
  • Use reader-level tolerance for a narrowly scoped integration or operation.
  • Use a DTO annotation when unknown input is intentionally accepted for that type.
  • Use mapper-wide tolerance only when the rule is deliberate across reads using that mapper.
  • Capture or inspect extra properties explicitly when discarding them would lose information the application needs.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Check the Jackson version and effective configuration

The FasterXML repository currently demonstrates Jackson 3.x builder configuration and notes the move away from direct ObjectMapper configuration in 3.x. The deserialization feature reference documents the feature behavior and per-reader option. Because project examples and API details can vary by major release—and frameworks may supply or configure the mapper—verify the exact Jackson version and runtime configuration before copying code into an application.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.