REST - How in the response we return only fields which we require?
<p>I was asked in an interview that you have an API - say <code>getCustomer</code>. This API returns details of the customer. But to reduce the size of the REST response, we need to return only the attributes which have value. So if <code>middleName</code> is not there for the customer, we should not see <code>{ middleName=null }</code> in the response. How can we do this?</p>