Reputation: 92
I have a Generic class:
@XmlSeeAlso({/*my classes here*/})
@XmlRootElement
public class Response<T> implements Serializable{ /*fields*/}
When the JSON response returns from the server, it comes with a @type information in it. I want to remove this from the response. Any help would be appreciated.
Response looks like the following:
{"response":{"@type":"myType","email":"[email protected]","firstName":"A","id":"3","lastName":"B","password":"12345","userName":"user"}}
I hope this is not a Jackson or Jersey bug.
Upvotes: 1
Views: 5250
Reputation: 1849
I was struggling with this as well, but this question is similar and the answer works Binding a Generic Java Class to a JSON using JAXB
It's a fairly simple answer although I'd struggle to explain why or how it works and doesn't cause the mapping to occur.
Upvotes: 0
Reputation:
This normally shows up because your Response
class is annotated with @JsonTypeInfo
. If you don't want it then you can remove this annotation, although bear in mind that then you will not have any information about the type you are returning.
Upvotes: 1