title: In postgresql, how can I return a boolean value instead of string on a jsonb key?
body: <p>In the query below, $isComplete and $isValid are returned as a string. However, they are saved as boolean values. How can I get the boolean representation of these fields to be returned?</p>
  
  <pre><code>query =
      "SELECT
          data #&gt;&gt; '{id}' AS id,
          data #&gt;&gt; '{name}' AS name,
          data #&gt;&gt; '{curator}' AS curator,
          data #&gt;  '{$isValid}' as \"$isValid\",
          data #&gt;  '{customer}' as customer,
          data #&gt;  '{$createdTS}' as \"$createdTS\",
          data #&gt;  '{$updatedTS}' as \"$updatedTS\",
          data #&gt;  '{$isComplete}' as \"$isComplete\",
          (count(keys))::numeric as \"numProducts\"
      FROM
        appointment_intakes,
        LATERAL jsonb_object_keys(data #&gt; '{products}') keys
      GROUP BY id"
  </code></pre>