Use code tag
Don't use decode of
Example:
So it normal to parse like this.
json_data['something']
Don't use decode of
json.load()
with Requests,theses are build into Requests.Example:
import requests url = 'https://api.github.com/' url_get = requests.get(url) json_data = url_get.json() print(url_get.encoding) print(type(json_data)) # Parse json print(json_data["current_user_url"])
Output:utf-8
<class 'dict'>
https://api.github.com/user
Error:TypeError : string indices must be integers
That's a common error message because in a larger json usually also a get back list in the dictionary.So it normal to parse like this.
json_data['something']
[0]
['CL_NOME']