I have json document as below. I would like to update all "points" to type integer. I'm familair with how to typecast. However I'm not able to reach to each indiviaul key/value pair inside the key "score". Would you please help me guide with the concept here
{"playerID": "123",
"score": [{"date": "1/1/2019",
"points": "10",
"somekey": "somevalue"
},
{"date": "1/1/2018",
"points": "100",
"somekey": "valuexyz"
}]
}
I tried to read the json data into variable called "data" data.get("score") returned a "list" of items item(0) gets me entire record - date, points, somekey. I'm not able to get to a specific key called points.
Should I onceagain convert my list to dictionary and then iterate to get to points? Isn't there any other way
data = {"playerID": "123",
"score": [{"date": "1/1/2019",
"points": "10",
"somekey": "somevalue"
},
{"date": "1/1/2018",
"points": "100",
"somekey": "valuexyz"
}]
}
dlist = data.get("score") #returns list