0

I have annotated a POJO on class level with

@org.codehaus.jackson.map.annotate.JsonSerialize(include=JsonSerialize.Inclusion.NON_EMPTY)

(annotating on method level doesn't work either) but null values will be serialized though. In my POM I have

<dependency>
  <groupId>org.glassfish.jersey.media</groupId>
  <artifactId>jersey-media-json-jackson</artifactId>
  <version>2.3.1</version>
</dependency>

How can I achieve that null values will NOT be serialized?

du-it
  • 2,561
  • 8
  • 42
  • 80
  • 1
    Can you post a fully qualified name of the annotation type? It could be that your are mixing Jackson 1.x and 2.x classes. – Alexey Gavrilov Jul 14 '14 at 21:16
  • I think @AlexeyGavrilov got it: Jersey still uses Jackson 1.x, and you are probably using Jackson 2.x annotations. – StaxMan Jul 15 '14 at 05:40
  • See above, please. Eclipse's code completion does NOT find @JsonInclude.... Trying @JsonInclude(Include.xxx) fails too. – du-it Jul 15 '14 at 07:06

0 Answers0