convert api response to json in python code example
Example 1: write dict to json python
import json
with open('result.json', 'w') as fp:
json.dump(sample, fp)
Example 2: python convert requests response to json
import json
import requests
response = requests.get(...)
json_data = json.loads(response.text)