title: How to output key values from json to a table using jq?
body: <p>I have this json which I get from an API.</p>
  <pre><code>{
  &quot;result&quot;: {
      &quot;key1&quot;: &quot;val1&quot;,
      &quot;key2&quot;: &quot;val2&quot;,
      &quot;key3&quot;: &quot;val3&quot;
   }
  }
  </code></pre>
  <p>I have the following shell script which creates headers for table in a text file. I want to extract key values from the above <code>result</code> object and put in the same text file where keys should go under <code>KEYS</code> and values under <code>VALUES</code> in the table. I am new to jq and shell and struggling to achieve this.</p>
  <pre><code>echo &quot;%table&quot;
  echo -e &quot;KEYS\tVALUES&quot; &gt; outputfile.txt
  KEYVALS=$(curl -uuser:password 
  &quot;http://localhost:8080/customapi&quot;)
  # here I want to split the key values using jq and write to the outputfile.txt 
  cat outputfile.txt
  </code></pre>
  <p>Outcome I am expecting is:</p>
  <pre><code>KEYS      VALUES
  key1      val1
  key2      val2
  key3      val3
  </code></pre>
  <p>How can I achieve this?</p>