I am struggling with the conversion of JSON to DataFrame. I get a JSON as a result of API request.
I tried pd.read_json, and pd.json_normalize and nothing helps. The result is always a DataFrame with (1,1) shape. I went through similar requests but looks like json_normalize helps everyone except me.
This is how my code looks today:
import requests
import json
import pandas as pd
response = requests.get("https://******************************/parameters/100135?from=1h",
                        auth = ('*******', '*******'), verify=False)
t = response.text
stud_obj = json.loads(t)
m = pd.json_normalize(stud_obj)
Here is an example of the JSON:
{
 "DataList" : [
  {
   "Parameter" : 100135,
   "Parameter Label" : "TC3; GR53; Irrigation Zones GR53; Row 2 Level 3 (6); Duration Of Waterings {",
   "DataSet" : [
    {
     "Data" : "0:00:00",
     "Time" : "Fri Jun 25 00:00:01 2021"
    },
    {
     "Data" : "0:00:01",
     "Time" : "Fri Jun 25 07:51:33 2021"
    },
    {
     "Data" : "0:00:02",
     "Time" : "Fri Jun 25 07:51:34 2021"
    },
    {
     "Data" : "0:00:03",
     "Time" : "Fri Jun 25 07:51:35 2021"
    }
   ]
  }
 ]
}
Here is a DataFrame as a result:
print(m)
                                                DataList
    0  [{'Parameter': 100135, 'Parameter Label': 'TC3...
m.shape
    (1, 1)