title: Add a single object to an array
body: <p>So I have this json structure:</p>
  <pre class="lang-json prettyprint-override"><code>{
    &quot;dog&quot;: [
      {
        &quot;name&quot;: &quot;sam&quot;,
        &quot;age&quot;: &quot;2&quot;
      },
      {
        &quot;name&quot;: &quot;billy&quot;,
        &quot;age&quot;: &quot;5&quot;
      }
    ]
  }
  </code></pre>
  <p>I've found that <code>.dog[1]</code> will return me the first object but not in the <code>dog:[]</code> array.</p>
  <pre class="lang-json prettyprint-override"><code>{
    &quot;name&quot;: &quot;billy&quot;,
    &quot;age&quot;: &quot;5&quot;
  }
  </code></pre>
  <p>and <code>.[] |= .[$i]</code> gives me an object:</p>
  <pre class="lang-json prettyprint-override"><code>{
    &quot;dog&quot;: {
      &quot;name&quot;: &quot;billy&quot;,
      &quot;age&quot;: &quot;5&quot;
    }
  }
  </code></pre>
  <p>What I want is:</p>
  <pre class="lang-json prettyprint-override"><code>{
    &quot;dog&quot;: [
      {
        &quot;name&quot;: &quot;sam&quot;,
        &quot;age&quot;: &quot;2&quot;
      }
    ]
  }
  </code></pre>
  <p>I plan to use this in a bash script, and write out to multiple files like:</p>
  <p><code>jq -r --argjson i &quot;$i&quot; '.[] |= .[$i]' &quot;$1&quot;</code></p>