Using Jackson, I know that I can include / exclude a property from serialization for presentation using @JsonView.
How to change the value of a JSON property on a view?
for example, I might want the property value in view A to be a whole object, since B is an object with certain properties filtered out in view C, I just want it to be "id" (without an object), and in to mind D, I might want it to be a "name" (without an object):
{
"prop": {"id": 123, "name": "abc", "description": "def"}
}
{
"prop": {"id": 123, "name": "abc"}
}
{
"prop": 123
}
{
"prop": "abc"
}
source
share