Serialize one class in two different ways with Jackson
问题 In one of our projects we use a java webapp talking to a MongoDB instance. In the database, we use DBRefs to keep track of some object relations. We (de)serialize with POJO objects using jackson (using mongodb-jackson-mapper). However, we use the same POJOs to then (de)serialize to the outside world, where our front end deals with presenting the JSON. Now, we need a way for the serialization for the outside world to contain the referenced object from a DBRef (so that the UI can present the