I am trying to return the fields and values of a specific key but getting error Here is the sample json format:
"results": [
{
"time": "00:00",
"app_name": "dcg",
"avg": "7717"
},
{
"time": "00:00",
"app_name": "pds",
"avg": "75.40223463687151"
},
{
"time": "00:00",
"app_name": "rdts",
"avg": "1481.5555555555557"
},
{
"time": "00:00",
"app_name": "slbl",
"avg": "786"
},
{
"time": "01:00",
"app_name": "pds",
"avg": "36.4765625"
}
here is my code
import json
json_data=open("some.json")
jdata = json.load(json_data)
for k, v in jdata.results.items():
for k1, v1 in v.items():
print(k1)
print(v1)
Please note results is key and time field having multiple entries with same value.