title: jq & bash: make JSON array from variable
body: <p>I'm using <a href="http://stedolan.github.io/jq/" title="jq">jq</a> to form a JSON in bash from variable values.</p>
  
  <p>Got how to make plain variables</p>
  
  <pre><code>$ VAR="one two three"
  $ jq -n "{var:\"$VAR\"}"
  {
    "var": "one two three"
  }
  </code></pre>
  
  <p>But can't make arrays yet. I have</p>
  
  <pre><code>$ echo $ARR
  one
  two
  three
  </code></pre>
  
  <p>and want to get something like</p>
  
  <pre><code>{
    "arr": ["one", "two", "three"]
  }
  </code></pre>
  
  <p>I only manage to get garbled output like</p>
  
  <pre><code>$ jq -n "{arr: [\"$ARR\"]}"
  {
    "arr": [
      "one\ntwo\nthree"
    ]
  }
  </code></pre>
  
  <p>How to form JSON array in a correct way? Can <code>jq</code> ever do that?</p>
  
  <p><strong>EDIT</strong>: Question was asked when there was only jq 1.3. Now, in jq 1.4, it is possible to do straightly what I asked for, like @JeffMercado and @peak suggested, upvote for them. Won't undo acceptance of @jbr 's answer though.</p>