I want to make POJO attribute optional for JSON response on certain condition.
Like below is my POJO for example.
Here in response of this POJO class, we get both the attributes whether values are available or not.
But i want that on certain condition, Attribute 'b' should pass and on false condition it should not pass in response.
I think we can set conditional setter for it but don't know how to set it.