I have wrote a JAX-RS server and client both use Jersey. I want to sent a collection of my entities to client and I made this steps:
Check if you are registering the media type for JSON support. Do you have jersey-media-moxy on your class-path? If not, add this dependency to your pom.xml, please check your jersey version, in this example I'm using Jersey 2 (2.24)
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-moxy</artifactId>
<version>2.24</version>
</dependency>
You can use jersey json library:
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>2.22</version>
</dependency>
Or genson:
<dependency>
<groupId>com.owlike</groupId>
<artifactId>genson</artifactId>
<version>1.3</version>
</dependency>