0

I need to exclude fields before a JSON response is sent, depending on the logged in user. Concretely I have [user]s belonging to [company]s.

If the logged-in-user is an administor, he/she should be able to see all companies with all users. If the user is not an administrator he/she should be able to see all companies and the list of users of his/her company, but not the userlist of foreign companies. Therefore i have to filter the result list not only dynamically but also selectively.

I have already found this thread: How do I exclude fields with Jackson not using annotations? and this thread: Jackson Change JsonIgnore Dynamically

Is there a way to iterate through the result set to remove certain fields?

Community
  • 1
  • 1
Daniel
  • 874
  • 10
  • 31
  • Use the solution provided in "how do I exclude fields with Jackson not using annotations" and change the input (the field name list) based on the user. – DwB Jan 12 '15 at 17:13
  • But that wouldn't be working because it has to be selective (if I got this right). I don't want to remove fields from every item in the list but only from certain items. – Daniel Jan 12 '15 at 18:30

0 Answers0