I am developing a REST interface for my app using Jackson to serialize my POJO domain objects to JSON representation. I want to customize the serialization for some types to
Another and perhaps the most simple solution:
Make serialisation a 2-step process. First create a Map like:
Map map = req.mapper().convertValue( result, new TypeReference
then add the properties you want like:
map.put( "custom", "value" );
then serialise this to json:
String json = req.mapper().writeValueAsString( map );