title: INDEX builtin with input
body: <p>I'm trying to build an INDEX from a json file which contains a list of flat objects.</p>
  
  <p>If I use the construct</p>
  
  <pre><code>jq 'INDEX(.a + ":" + .b)' &lt; data.json 
  </code></pre>
  
  <p>I get what i want. But if I use </p>
  
  <pre><code>jq 'INDEX(input; .a + ":" + .b) data.json
  </code></pre>
  
  <p>then I get the error</p>
  
  <pre><code>jq: error (at data.json:&lt;last-line&gt;): break
  </code></pre>
  
  <p>The reason I need to use the second form is that I will then need to JOIN another <code>input</code> to the index of the first, and I don't see how to do that from STDIN.</p>
  
  <p>Any ideas how I can get around this?</p>
  
  <p>(Currently running jq-1.6 on MacOS 10.13.6)</p>
  
  <p>Adding input (data.json): </p>
  
  <pre><code>[
      {
          "a": "a1",
          "b": "b1",
          "c": "c1",
          "d": "d1"
      },
      {
          "a": "a2",
          "b": "b2",
          "c": "c2",
          "d": "d2"
      },
      {
          "a": "a3",
          "b": "b3",
          "c": "c3",
          "d": "d3"
      }
  ]
  </code></pre>
  
  <p>And expected output</p>
  
  <pre><code>{
    "a1:b1": {
      "a": "a1",
      "b": "b1",
      "c": "c1",
      "d": "d1"
    },
    "a2:b2": {
      "a": "a2",
      "b": "b2",
      "c": "c2",
      "d": "d2"
    },
    "a3:b3": {
      "a": "a3",
      "b": "b3",
      "c": "c3",
      "d": "d3"
    }
  }
  </code></pre>