简体   繁体   中英

how to serialize a pojo with jackson in 2 different ways?

I have a different rest endpoints that returns different parts of the same object. how can i serialize the same object in 2 different ways? do I need different DTO or is there a simpler way?

You can create different views for different rest endpoints.

See the documentation here: http://wiki.fasterxml.com/JacksonJsonViews

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM