title: Accessing array/object variables by key, within a handlebars mustache
body: <p>I can't seem to find a way of doing this, and have tried subexpressions and various other answers posted on StackOverflow - but they all seem to assume that I know the key I'm using in advance.</p>
  
  <p>I have the following object:</p>
  
  <pre><code>{
      fields: {
          1: {
              complete: 1,
              submitted: 0
          },
          2: {
              complete: 1,
              submitted: 0
          }
  }
  </code></pre>
  
  <p>etc. etc.</p>
  
  <p>In my Handlebars template, I'm looping through an array of objects. Each object in that array has a <code>field_id</code> key which is a number that matches up to the 1 or 2 in the above example.</p>
  
  <p>I need to access the variables in the above array structure, based on the current field_id being looped. I've tried:</p>
  
  <p><code>{{fields[(field_id)].complete}}</code></p>
  
  <p><code>{{fields[{{field_id}}].complete}}</code></p>
  
  <p><code>{{fields.(field_id).complete}}</code></p>
  
  <p><code>{{fields.({{field_id}}).complete}}</code></p>
  
  <p>And none of them work.</p>
  
  <p>Is there a way of doing this?</p>