开发者

Get selected fields from Java POJO during serialisation and deserialisation

开发者 https://www.devze.com 2023-04-12 12:18 出处:网络
Suppose I am having POJO which contains 10 fields and getter/setter for each one. I wou开发者_开发百科ld like to get the selected fields from that POJO during serialization and deserialization dependi

Suppose I am having POJO which contains 10 fields and getter/setter for each one. I wou开发者_开发百科ld like to get the selected fields from that POJO during serialization and deserialization depending on some conditions. Can i achieve this using Jackson?? If so then can some on help me out and give some idea?


For serialization, you could read "Filtering properties with Jackson" for some possibilities.

As to deserialization, one possibility would be to first bind to a Map or JsonNode, then pick properties from there -- filtering options do not work deserialization.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号