When I make a request, I get a response in XML, but what I need is JSON. In the doc it is stated in order to get a JSON in return: Use the Accept: application/json
Well Curl could be a better option for json representation but in that case it would be difficult to understand the structure of json because its in command line. if you want to get your json on browser you simply remove all the XML Annotations like -
@XmlRootElement(name="person")
@XmlAccessorType(XmlAccessType.NONE)
@XmlAttribute
@XmlElement
from your model class and than run the same url, you have used for xml representation.
Make sure that you have jacson-databind dependency in your pom.xml
com.fasterxml.jackson.core
jackson-databind
2.4.1