title: How to add an new value to an existing json array?
body: <p>My json structure is like this:</p>
  <pre><code>{
      &quot;intents&quot;: [
          {
              &quot;tag&quot;: &quot;greeting&quot;,
              &quot;patterns&quot;: [
                  &quot;Hi there&quot;,
                  &quot;How are you&quot;,
                  &quot;Is anyone there?&quot;,
                  &quot;Hey&quot;,
                  &quot;Hola&quot;,
                  &quot;Hello&quot;,
                  &quot;Good day&quot;
              ],
              &quot;responses&quot;: [
                  &quot;Hello, thanks for asking&quot;,
                  &quot;Good to see you again&quot;,
                  &quot;Hi there, how can I help?&quot;
              ],
              &quot;context&quot;: [&quot;&quot;]
          },
  </code></pre>
  <p>My intention to append a new pattern or response under this tag which is already existing in an array.</p>
  <pre><code>tgname = request.form['tags']
  x = request.form['newres']
  
  with open('intents.json', 'r') as file:
      data = json.load(file)
  
  for t in data[&quot;intents&quot;]:
      if t['tag'] == tgname:
  
          temp1 = data['responses']
          temp1.append(x)
  
          with open(filename,'w') as f:
              json.dump(data, f)
  </code></pre>
  <p>I am getting <code>keyword error:'responses'</code>. How to resolve this?</p>