I have a class that I am serializing/deserializing from/to both JSON, XML using Jackson.
public class User {
Integer userId;
String name;
Integer groupId;
...
}
I want to ignore groupId when doing xml processing, so my XMLs won't include it:
<User>
<userId>...</userId>
<name>...</name>
</User>
But the JSONs will:
{
"userId":"...",
"name":"...",
"groupId":"..."
}
I know that @JsonIgnore will work in both, but I want to ignore it only in the xml.
I know about the mix-in annotations that can be used to do this (https://stackoverflow.com/a/22906823/2487263), but I think there should be a simple annotation that does this, but cannot find it. Jackson documentation (at least for me) is not as good as I would like when trying to find these kind of things.