title: How to convert a JSON object stream into an array with jq
body: <p>I want to use <code>jq</code> to put a stream of json objects into a json array, for example, from </p>
  
  <pre><code>{"a":1}
  {"b":2}
  </code></pre>
  
  <p>to</p>
  
  <pre><code>[{"a":1},
  {"b":2}]
  </code></pre>
  
  <p>But this would not work </p>
  
  <pre><code>echo '
  {"a":1}
  {"b":2}
  '|jq '[.]'
  </code></pre>
  
  <p>since I got</p>
  
  <pre><code>[
    {
      "a": 1
    }
  ]
  [
    {
      "b": 2
    }
  ]
  </code></pre>