title: How to Get JSON values Python
body: <p>Learning Days
  Code to the get the data in JSON Format</p>
  
  <pre><code>#...
  cursor.execute("SELECT * FROM user")
  response = {
      "version": "5.2",
      "user_type": "online",
      "user": list(cursor),
  }
  response = json.dumps(response, sort_keys=False, indent=4, separators=(',', ': '))
  print(response)
  # ...
  </code></pre>
  
  <p>This produces output as </p>
  
  <pre><code>{
  "version": "5.2",
  "user_type": "online",
  "user":
  [
      {
          "name": "John",
          "id": 50
      },
      {
          "name": "Mark",
          "id": 57
      }
  ]
  }
  
  print(response["user"]) - TypeError: string indices must be integers
  </code></pre>
  
  <p>How do i access the values in JSON</p>