我正在从如下所示的URL阅读
def findPlace():
url = "https:myurl.com"
with urllib.request.urlopen(url) as ur:
response = ur.read()
jObj=json.loads(response)
return jObj
jObj是字典。如何将其转换为JSON对象?我尝试使用json.dump
,如下所示:
def findPlace():
url = "https:myurl.com"
with urllib.request.urlopen(url) as ur:
response = ur.read()
jObj=json.loads(json.dumps(response))
return jObj
但是它会引发错误TypeError: Object of type 'bytes' is not JSON serializable
有什么建议吗?