title: MySQL - Conditionally build JSON_OBJECT
body: <p>Is it possible to conditionally build a json object e.g.:</p>
  
  <pre><code>mysql&gt; SELECT JSON_OBJECT(
        CASE
          WHEN some_condition THEN key, val
          ELSE
             // do nothing 
          END CASE
  
      );
  </code></pre>
  
  <p>If not, how can I conditionally build a json object. Bascially I only want to inlcude non null properties.</p>