简体   繁体   English

如何以2种不同的方式序列化与杰克逊的pojo?

[英]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? 如何以2种不同方式序列化同一对象? do I need different DTO or is there a simpler way? 我需要不同的DTO还是有更简单的方法?

You can create different views for different rest endpoints. 您可以为不同的其余端点创建不同的视图。

See the documentation here: http://wiki.fasterxml.com/JacksonJsonViews 请参阅此处的文档: http : //wiki.fasterxml.com/JacksonJsonViews

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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