title: How to display a row without showing its null columns in PostgreSQL?
body: <p>I want to show all the rows in my table with all the columns except those columns that are null.</p>
  <pre><code>-- SELECT all users
  SELECT * FROM users
  ORDER BY user_id ASC;
  
  -- SELECT a user
  SELECT * FROM users
  WHERE user_id = $1;
  </code></pre>
  <p>Currently my API's GET request returns something like this with the above queries:</p>
  <pre><code>{
     &quot;user_id&quot;: 10,
     &quot;name&quot;: &quot;Bruce Wayne&quot;,
     &quot;username&quot;: &quot;Batman&quot;,
     &quot;email&quot;: &quot;bat@cave.com&quot;,
     &quot;phone&quot;: null,
     &quot;website&quot;: null
  }
  </code></pre>
  <p><strong>Is there any way I can display it like this so that the null columns aren't shown?</strong></p>
  <pre><code>{
     &quot;user_id&quot;: 10,
     &quot;name&quot;: &quot;Bruce Wayne&quot;,
     &quot;username&quot;: &quot;Batman&quot;,
     &quot;email&quot;: &quot;bat@cave.com&quot;
  }
  </code></pre>