title: Which is better practice in Rest API, to return NESTED empty objects (no data), first level empty object or null or 404?
body: <p>For instance:
  Considering <code>type Person = {id: number; name:string; age: number; description?: {eyes: string } }</code>
  Considering <code>user: Person</code>
  we call the endpoint GET host/user/1</p>
  <p><strong>Scenario 1: user with id = 1 doesnt exist:</strong></p>
  <ul>
  <li>response1:</li>
  </ul>
  <p><code>{id: null, name: null, age: null, description: {eyes: null}}</code></p>
  <ul>
  <li>response2:</li>
  </ul>
  <p><code>{}</code></p>
  <ul>
  <li>response3:</li>
  </ul>
  <p><code>null</code></p>
  <ul>
  <li>response4:</li>
  </ul>
  <p>http no-data code (404, 204)</p>
  <p><strong>Scenario 2: user with id = 1 DOES exist without optional attribute description:</strong></p>
  <ol>
  <li>response1:</li>
  </ol>
  <p><code>{id: 1, name: &quot;a name&quot;, age: 20 , description: {eyes: null}}</code></p>
  <ol start="2">
  <li>response2:</li>
  </ol>
  <p><code>{id: 1, name: &quot;a name&quot;, age: 20 , description: {}}</code></p>
  <ol start="3">
  <li>response3:</li>
  </ol>
  <p><code>{id: 1, name: &quot;a name&quot;, age: 20 , description: null} </code></p>
  <p>In my opinion <a href="https://developer.mozilla.org/en-US/docs/Glossary/Falsy" rel="nofollow noreferrer">falsy</a> values (or the 404/204 in the first scenario) would be the best for empty attributes as they are easier and cleaner to handle.</p>
  <p>Note: I found several similiar questions in StackOverflow but none of then with nested objects</p>