Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using class to determine what fields are serialized with Jackson

 
Kerry Wilson
Ranch Hand
Posts: 254
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the fastest way to use a class to determine which fields are serialized by jackson. I have objects defined in my gwt app that I would like to use for this. This seems like it would be a somewhat common use case.

I am familiar with JsonViews, but this would require me to annotate fields in the object. Effectively duplicating the 'which fields are included' logic (in the BookDetail object and in the Book entity)

I have looked into JsonFilter, but this seems like each entity (Book) could only have one filter and I haven't figured out how to use a class definition to define the filter.

The ideal solution would look something like this. Is this possible out of the box, or am I going to have to 'roll my own' bean serializer?

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic