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