How can I put integer as an argument in jq?
<p>I have been trying to use jq to parse a json file returned from the aws cli, but I'm stuck with the problem of referencing an array using the index number. I need to do this because I want to export a text file describing the security groups in a specific format, including all the inbound and outbound rules.</p>

<pre><code>for (( i=1; i&lt;=groupCount; i++ )) ; 
do
    echo $i
    echo $(echo "$input" | jq --arg i $i '.SecurityGroups[$i]')
done
</code></pre>

<p>This returns an error:</p>

<pre><code>1
jq: error (at &lt;stdin&gt;:189): Cannot index array with string "1"

2
jq: error (at &lt;stdin&gt;:189): Cannot index array with string "2"

3
jq: error (at &lt;stdin&gt;:189): Cannot index array with string "3"
</code></pre>

<p>Is there any way around this?</p>