title: Accessing Nested Json Keys in Slack API - Python
body: <p>Having trouble parsing the JSON response in Python. I'm looking to return the object that correlates with the ID in the for loop in the below code but receiving the error:</p>
  <pre><code>TypeError: string indices must be integers
  </code></pre>
  <p>If I remove <code>'[0]'</code> in the data variable</p>
  <pre><code>TypeError: 'builtin_function_or_method' object is not subscriptable
  </code></pre>
  <p>Code:</p>
  <pre><code>import requests
  import json
  
  def get_slackusers():
      uri = &quot;https://slack.com/api/users.list?token=tokenhere&quot;
  
      try:
          response = requests.get(uri)
      except requests.exceptions.RequestException as error:
          print(error)
      
  
      data = json.loads(response.text)['members'][0]
  
      for i in data:
          if i['id'] == 'slackIDhere':
              print[i]
  </code></pre>
  <p>Any help is appreciated. Thank you.</p>