jackson ignore values if empty

Solutions on MaxInterview for jackson ignore values if empty by the best coders in the world

showing results for - "jackson ignore values if empty"
Camila
14 Jan 2018
1// every Value
2
3@JsonInclude(JsonInclude.Include.NON_EMPTY)
4public class ObjectWithoutEmpty {
5
6  	// only not empty Values get included 
7    @JsonProperty("propertyOne")
8    private String propertyOne;
9
10  	// only not empty Values get included 
11    @JsonProperty("propertyTWO")
12    private String propertyTWO;
13
14}
15
16// one property
17
18
19public class ObjectWithoutEmpty {
20
21  	// only non empty Values get included 
22  	@JsonInclude(JsonInclude.Include.NON_EMPTY)
23    @JsonProperty("propertyOne")
24    private String propertyOne;
25  
26	// empty Values get included 
27    @JsonProperty("propertyTWO")
28    private String propertyTWO;
29
30}
31