Skip to content

How could I have different behaviors for null serialization of different JavaType? #266

Closed Answered by cowtowncoder
xdudna asked this question in Q&A
Discussion options

You must be logged in to vote

One possibility is using @JsonSerialize.nullsUsing:

        @JsonSerialize(nullsUsing=NullSerializer.class)
        public String name;

and if you do not want to use annotations (even mix-in annotations), can override method findNullSerializer() in AnnotationIntrospector (default one being JacksonAnnotationIntrospector).

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@xdudna
Comment options

@cowtowncoder
Comment options

Answer selected by xdudna
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants