title: Jinja 2 - Value from list
body: <p>When I'm posting <code>object['userinfo']</code> to Jinja2 HTML, it renders this info.</p>
  
  <pre><code>[{  
      'enemies':[  
  
      ],
      'url':'URL',
      'friends':[  
          {  
              'area':2,
              'same_interest':6
          }
      ]
  }]
  </code></pre>
  
  <p>So if I'm getting <code>object['userinfo'][0]</code> it will return the object:</p>
  
  <pre><code>{  
      'enemies':[  
  
      ],
      'url':'URL',
      'friends':[  
          {  
              'area':2,
              'same_interest':6
          }
      ]
  }
  </code></pre>
  
  <p>But as soon as I'm trying to get the URL value from the object (<code>object['userinfo'][0]['url']</code>),
   I get an error:
  <code>jinja2.exceptions.UndefinedError: list object has no element 0</code>
  even though I can access the "0" element without any other key.</p>
  
  <p>EDIT:
  Full error traceback:</p>
  
  <pre><code>     [2018-05-11 17:02:30,617] ERROR in app: Exception on /start [POST]
  Traceback (most recent call last):
    File "/flask/venv/lib/python3.5/site-packages/flask/app.py", line 2292, in wsgi_app
      response = self.full_dispatch_request()
    File "/flask/venv/lib/python3.5/site-packages/flask/app.py", line 1815, in full_dispatch_request
      rv = self.handle_user_exception(e)
    File "/flask/venv/lib/python3.5/site-packages/flask/app.py", line 1718, in handle_user_exception
      reraise(exc_type, exc_value, tb)
    File "/flask/venv/lib/python3.5/site-packages/flask/_compat.py", line 35, in reraise
      raise value
    File "/flask/venv/lib/python3.5/site-packages/flask/app.py", line 1813, in full_dispatch_request
      rv = self.dispatch_request()
    File "/flask/venv/lib/python3.5/site-packages/flask/app.py", line 1799, in dispatch_request
      return self.view_functions[rule.endpoint](**req.view_args)
    File "/flask/app.py", line 117, in startreporting
      return render_template("report.html", items=loaded_r)
    File "/flask/venv/lib/python3.5/site-packages/flask/templating.py", line 135, in render_template
      context, ctx.app)
    File "/flask/venv/lib/python3.5/site-packages/flask/templating.py", line 117, in _render
      rv = template.render(context)
    File "/flask/venv/lib/python3.5/site-packages/jinja2/environment.py", line 1008, in render
      return self.environment.handle_exception(exc_info, True)
    File "/flask/venv/lib/python3.5/site-packages/jinja2/environment.py", line 780, in handle_exception
      reraise(exc_type, exc_value, tb)
    File "/flask/venv/lib/python3.5/site-packages/jinja2/_compat.py", line 37, in reraise
      raise value.with_traceback(tb)
    File "/flask/templates/report.html", line 29, in top-level template code
      &lt;td&gt;{{ x['userinfo'][0]['url'] }}&lt;/td&gt;
    File "/flask/venv/lib/python3.5/site-packages/jinja2/environment.py", line 411, in getitem
      return obj[argument]
  jinja2.exceptions.UndefinedError: list object has no element 0
  127.0.0.1 - - [11/May/2018 17:02:30] "POST /start HTTP/1.1" 500 -
  </code></pre>
  
  <p>How can I access the keys within the first array of the object?</p>