I am trying to create a very simple REST service using Jersey. Here is the service code
@Path(\"/UserService\")
publ
Your xml was working so I assume that you have @XmlRootElement
annotation in your User
class.
The thing is, it knows how to convert it to xml with the annotation @XmlRootElement
but it doesn't know how to convert it to JSON.
So for making it convert everything to JSON with the same annotation of xml(ie @XmlRootElement
) we can add
jersey-media-moxy-
or for maven users
org.glassfish.jersey.media
jersey-media-moxy
Also it should have a no argument constructor