requests json to dict code example
Example 1: python convert requests response to json
import json
import requests
response = requests.get(...)
json_data = json.loads(response.text)
Example 2: python json to dict
import json
info = '{"name": "Dave","City": "NY"}'
res = json.loads(info)
print(res)
print("Datatype of the serialized JSON data : " + str(type(res)))
info = open('data.json',)
res = json.load(info)
print(res)
print("Datatype after deserialization : " + str(type(res)))
Example 3: convert response to json python
import json
import requests
response = requests.get(...)
json_data = json.loads(response.text)