title: jq doesn't work with keys which contains dash in it from a variable
body: <p>If you'd like jq to escape dashes, you need to put your key between square brackets like this;</p>
  
  <p><code>jq '.["key-key"]'</code></p>
  
  <p>and apart from that, if you'd like to include a variable in jq, you need to use double quotes instead of single quotes;</p>
  
  <p><code>jq "."${var[i+1]}""</code></p>
  
  <p>but my variable contains dash in it and in this case, I've tried to merge the 2 examples above but it didn't work;</p>
  
  <pre><code>var=key-key
  jq ".["${var[i+1]}"]."key""
  </code></pre>
  
  <p>how can I get this work?</p>
  
  <p>Update:</p>
  
  <p>This is the final script, which I've forgot to mention;</p>
  
  <pre class="lang-sh prettyprint-override"><code>declare -a var=(
      "key-key"
      "key2-key2"
      "key3-key3"
  )
  
  for ((i=0; i&lt;${#var[@]})); do
      curl -s "url" | jq ".["${var}"]."something""
  done
  </code></pre>