Wednesday 18 September 2024

Python change response content to JSON


https://stackoverflow.com/questions/16877422/whats-the-best-way-to-parse-a-json-response-from-the-requests-library

by default python 

response object saves actual resposne in "data"

https://www.geeksforgeeks.org/response-json-python-requests/


you can use response.json() to get the "data" list / object

to get everything:

 import json

import requests

response = requests.get(...)
json_data = json.loads(response.text)

// conver list to json string
json.dumps()

// convert json string to list
json.loads

No comments:

Post a Comment