json()
- 功能:将是JSON格式的字符串转化为字典
- 例子:response.json()与json.loads(response.text)结果是一致的
import requests
import json
response = requests.get("http://httpbin.org/get")
print(response.text)
print(type(response.text)) # <class 'str'>
print(type(response.json())) # <class 'dict'>
print(response.json())
print(json.loads(response.text))