title: How to create json body using jq from variables, while preserving type
body: <p>I am creating a simple bash script and am trying to build a json body using jq</p>
  <pre><code>name='&quot;john&quot;'
  objects='[]'
  count='1'
  
  data=$( jq -n \
              --arg na $name \
              --arg ob $objects \
              --arg ct $count \
              '{name: $na, objects: $ob, count: $ct}' )
  </code></pre>
  <p>When I echo data, I get
  <code>{ &quot;name&quot;: &quot;\&quot;john\&quot;&quot;, &quot;objects&quot;: &quot;[]&quot;, &quot;count&quot;: &quot;1&quot; }</code></p>
  <p>However, the objects and count values are strings.
  Instead I want, <code>{ &quot;name&quot;: &quot;john&quot;, &quot;objects&quot;: [], &quot;count&quot;: 1 }</code></p>