Jackson - suppressing serialization(write) of properties dynamically

前端 未结 4 2136
难免孤独
难免孤独 2021-01-04 10:21

I am trying to convert java object to JSON object in Tomcat/jersey using Jackson. And want to suppress serialization(write) of certain properties dynamically.

I can

4条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-04 10:59

    I don't see any way of doing that. If you need to dynamically decide which properties are marshalled, then I suggest you manually construct a Map of keys to values for your objects, and then pass that Map to Jackson, rather than passing the User object directly.

提交回复
热议问题