0

I have read several responses on here from several years ago that suggests something like this would bring me from an API response to a pandas dataframe:

r = requests.request("GET", get_url, headers=headers, data=payload)

print(r.text)

df=pd.DataFrame.from_dict(r.json())

However, the result of this is:

Dataframe Preview

I end up with two columns, one "count" and one "leases" that contains the actual output per unique identifier. It is what I see in that leases column that I would like converted into a dataframe. Is there a simple way to do this? I think I need to remove the most outward nest with the "count" portion of the response but I am not sure how to achieve this elegantly.

JSON text response from the API (clipped):

{"count":298,"leases":[{"itemId":0,"leaseInst":328,"leas [...]

I am avoiding the older posts that suggest normalize_json because it appears to be deprecated, sadly.

General Grievance
  • 4,555
  • 31
  • 31
  • 45
ariana20
  • 5
  • 1

0 Answers0