I am using python 3.4 and trying to parse what seems like valid JSON output from a url. ex: http://api.stackexchange.com/2.2/questions?order=desc&sort=activity&site=stackoverflow
This is what my code looks like
import json
from urllib.request import urlopen
def jsonify(url):
response = urlopen(url).read().decode('utf8')
repo = json.loads(response)
return repo
url = jsonify('http://api.stackexchange.com/2.2/questions?order=desc&sort=activity&site=stackoverflow');
However, I get errors such as UnicodeDecodeError utf-8 codec can't decode byte 0x8b in position 1; invalid start byte
The script works with any other API, like github and so many others, but not with the stackexchange api
Invalid character in identifierand it points to the.in afterheaders