users@jersey.java.net

jersey with jackson

From: Matthew M. Boedicker <matthewm_at_boedicker.org>
Date: Mon, 25 Oct 2010 16:35:43 -0400

I am trying to use Jackson to change the way Jersey generates JSON.
The features I want are:

- single element lists become JSON lists with one element
- empty lists become empty JSON lists
- JSON numbers and booleans are used (not everything becomes a JSON String)
- fields with null values are left out of JSON objects

I am using Jersey 1.4. The way I have gotten these to work are to put
jackson-core-asl-1.6.1.jar, jackson-jaxrs-asl-1.6.1.jar,
jackson-mapper-asl-1.6.1.jar, and jackson-xc-1.6.1.jar in my
classpath. Jersey sees the providers and uses them with no additional
configuration. To get Jackson to skip null elements I added
"@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)" to all the
beans.

I know that Jersey already uses some parts of Jackson. Any way to get
the same behavior without adding the Jackson jars?