Dynamically remove properties from api response
<p>I have a api whose response is as below 
<br>  "prop1": "SomeValu1",
<br>  "prop2": "SomeValue2",
<br>  "prop3": null,
<br>  "prop4": "SomeValue4"</p>

<p>The problem is, based on input some of the properties will be null(expected behavior) which i don;t want to
  return in the response. Something like this (prop3 is not there)<br>
<br>  "prop1": "SomeValu1",
<br>  "prop2": "SomeValue2",
<br>  "prop4": "SomeValue4"</p>

<p>Which property will be null is based on runtime logic. Any ideas how can i do this?</p>