I am using Python’s request library to retrieve data from a web API. When viewing my data using requests.text, it returns a string of a large JSON object, e.g.,
'{"Pennsylvania": {"Sales": [{"date":"2021-12-01", "id": "Metric67", ... '
Naturally, the type of this object is currently a string. What is the best way to cover this string/JSON to a Pandas Dataframe?
>Solution :
You can use the default synatx for API calls:
r=requests.get(YOUR_URL)
res=r.json()
NOTE: r.text returns json as text.