title: Is there a way to include null columns in my json output when using apex_json
body: <p>I have a number of stored procedures in my 19c database and I am using the apex_json package to convert the results of a cursor to json for a rest api.</p>
  <p>Recently I discovered that some of the columns I am selecting have null values in them, so when the json is generated that column is not included in the output.  Unfortunately when I use knnockout to bind the json to my web page, the viewmodel javascript fails because there is no column to bind in some cases.</p>
  <p>So my question is there a way to configure apex_json either when opening it or when writing it to tell the package that I want to include &quot;null&quot; or something similar in the json output for null columns in the input cursor?</p>
  <p>Sample stored procedure:</p>
  <pre><code>create or replace procedure  my_demo
  ) as
      l_cur sys_refcursor;
  begin
      open l_cur for
          select name,email,phonenumber
      from temp
      order by name;
  
  -- return the resultset in json format
  apex_json.open_object;
  apex_json. write('data',l_cur);
  apex_json.close_object;
  
  end my_demo;
  </code></pre>
  <p>Current output:</p>
  <pre><code>{
  &quot;data&quot; : [
  {&quot;name&quot;:&quot;Barney&quot;,&quot;email&quot;:&quot;barney@example.com&quot;,&quot;phonenumber&quot;:&quot;555.1212&quot;},
  {&quot;name&quot;:&quot;Fred&quot;,&quot;email&quot;:&quot;fred@example.com&quot;},
  {&quot;name&quot;:&quot;Robert&quot;,&quot;email&quot;robert@example.com&quot;,&quot;phonenumber&quot;:&quot;555.2323&quot;}
  ]}
  </code></pre>
  <p>Expected output:</p>
  <pre><code>{
  &quot;data&quot; : [
  {&quot;name&quot;:&quot;Barney&quot;,&quot;email&quot;:&quot;barney@example.com&quot;,&quot;phonenumber&quot;:&quot;555.1212&quot;},
  {&quot;name&quot;:&quot;Fred&quot;,&quot;email&quot;:&quot;fred@example.com&quot;,&quot;phonenumber&quot;:&quot;&quot;},
  {&quot;name&quot;:&quot;Robert&quot;,&quot;email&quot;robert@example.com&quot;,&quot;phonenumber&quot;:&quot;555.2323&quot;}
  ]}
  </code></pre>