Is it possible to serialize a JSON response while excluding some elements based on If conditions?
if(a == 1) {
//show element
} else {
//don't show element
}
I've tried using @JSONIgnore, but that simply ignores the element regardless of conditions. I'm new to this space. Any ideas?
EDIT: I'm working on enterprise software, so using 3rd party libraries and such won't be a possibility.