I am using genson 1.4 and jersey 2.12. I also added the @XmlRootElement annotation to the Java class I'm using for the response object. I set the @Produces annotation to handle both XML & JSON such that I get XML back as the default. Technically, the first one in the @Produces annotation list should be used if the Accept header isn't specified. However, I'm getting JSON back if the Accept header with application/xml isn't included in the curl command. If I specify -H "Accept: application/xml" in the curl command, I get back the XML representation. Also, if I just specify @Produces({ MediaType.APPLICATION_XML}), I get back the XML representation. Does genson default to the first item specified in the @Produces annotation?
I also specify -H "Content-Type: application/json" -in the curl command since I'm sending JSON in the entity object.