jackson - Collection Wrapper as JSON List? -
i need wrap list<something>
in dto (say, wrapper
) custom annotations work expected. end this:
public class wrapper { private list<something> list; @customannotationshere public list<something> getlist() { ... } public void setlist(list<something> list) { ... } }
however, makes jackson serialize/deserialize wrapper
object as
{ "list": [...] }
which, imho, verbose , unnecessarily complex. there way have jackson serialize/deserialize wrapper
object list (the value of list
field)?
i swear once came across annotation-based way of achieving this, @ moment can't recall where.
add @jsonvalue
field serialization, , single-argument constructor deserialization?
Comments
Post a Comment