Thanks! how can that annotation be included in a MixIn?

On Wednesday, August 7, 2019 at 2:27:35 PM UTC-3, Tatu Saloranta wrote:
>
> On Wed, Aug 7, 2019 at 9:38 AM Pablo Pazos <[email protected] 
> <javascript:>> wrote: 
> > 
> > Hi, I have a complex model, where some attributes are collections and if 
> the collection is empty I need to ignore adding if to the serialized JSON 
> object, because right now I see items: [] everywhere (many of my classes 
> have that attribute but it's empty most of the time. 
> > 
> > Is there a way to do this in Jackson? 
>
> Via annotations you would add 
>
> @JsonInclude(include = Include.NON_EMPTY) 
>
> but there is also "config override" setting to define default; usage 
> maybe best seen in 
>
> src/test/java/com/fasterxml/jackson/databind/ser/filter/JsonIncludeOverrideTest.java
>  
>
>
> but you can basically define default inclusion setting for all 
> properties, or properties of certain type (based on declared property 
> type) 
>
> Hope this helps, 
>
> -+ Tatu +- 
>
> > 
> > Thanks! 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups "jackson-user" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to [email protected] <javascript:>. 
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/jackson-user/e1f875ee-6d36-4a03-89a7-0e8bee7157d4%40googlegroups.com.
>  
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"jackson-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jackson-user/052b9d63-64ed-4a51-afa8-479ed1166896%40googlegroups.com.

Reply via email to