-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Milestone
Description
I have an object (a links
holder) that is essentially a container around a java.util.Map
. The map is annotated with @JsonValue
, and this behaves as expected (the map is dumped as a JSON object inline).
However, I only want this included when the map is non-empty, so I annotated the getLinks()
method with @JsonInclude(NON_EMPTY)
. However, it appears that the inclusion filter is applied before the value substitution, so it is always included even as {}
.
I'm using Jackson 2.11.2 (managed via Spring Boot).
@Data
class Wrapper {
@JsonValue
Map<String, String> values;
}
@Data
class TopLevel {
@JsonInclude(NON_EMPTY)
Wrapper nested;
}
Metadata
Metadata
Assignees
Labels
No labels