Win a copy of Zero to AI - A non-technical, hype-free guide to prospering in the AI era this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

Using class to determine what fields are serialized with Jackson

 
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?

 
Pay attention! Tiny ad!
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic