title: How to add a dictionary to .json list written in file
body: <p>I am trying to add a .json dictionary to the <code>&quot;Steps&quot;</code> list that's written in another file.</p>
  <pre><code>{
      &quot;UPDATED AFTER IMPORT&quot;: {
          &quot;ID&quot;   : &quot;UPDATED AFTER IMPORT&quot;,
          &quot;Name&quot; : &quot;Sample Name&quot;,
          &quot;Steps&quot;: []
      }
  }
  </code></pre>
  <p>I am getting this error.</p>
  <pre><code>f[&quot;UPDATE AFTER  IMPORT&quot;].append({&quot;Steps&quot;:[outputfile]})
  TypeError: '_io.TextIOWrapper' object is not subscriptable
  </code></pre>
  <p>Here's what I tried.</p>
  <pre><code>with open (stepjson, 'r+', encoding = 'utf-8') as jsonfile: #open step template
      data = json.load(jsonfile)
  data[&quot;Config&quot;][&quot;Script&quot;].update({&quot;Args&quot;:args_str}) #update args in step.json template
  with open(json_dir+csvfilename +'.json', 'a') as f: #add edited step.json template to final .json file
      outputfile = json.dumps(data,indent=4)  
      f[&quot;UPDATE AFTER  IMPORT&quot;].append({&quot;Steps&quot;:[outputfile]})
  </code></pre>