Skip to content

@JsonInclude(NON_DEFAULT) doesn't omit null fields #1351

@cowwoc

Description

@cowwoc

Jackson 2.8.0

  1. I set ObjectMapper.setSerializationInclusion(NON_DEFAULT).
  2. I have a POJO without a default constructor containing a double field and a LocalDate field. The fields are set to 0 and null respectively.
  3. When I serialize the POJO, the null date gets serialized but the double gets omitted.

I am expecting both fields to get omitted because both contain the type's default value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions