0

I have a class that I use for things that I pull from Kafka or store in Redis. However, I just want to remove a couple of sensitive entries from it before I send it to the user.

One approach I had was to create a separate return class and copy each field one at a time, but I switched to a different approach in that I use object mapper to convert it to a map and then just strip off the element.

However, I was wondering if there was a nicer way.

I can't use @JsonIgnore as I am using it with @JsonProperty right now.

Archimedes Trajano
  • 35,625
  • 19
  • 175
  • 265
  • 1
    Does this help? https://stackoverflow.com/questions/38279782/what-is-the-json-view-class-in-jackson-and-how-does-it-work – dnault Sep 22 '20 at 21:07
  • almost, I use RESTEasy though so I can't use the RestController. I am adding JAX-RS to the tags – Archimedes Trajano Sep 22 '20 at 22:24
  • How about this (RESTEasy-specific)? https://stackoverflow.com/questions/20634275/can-i-specify-the-jackson-jsonview-to-use-for-method-result-transformation-in-r – dnault Sep 22 '20 at 22:42

0 Answers0