Here is the JSON data in question:
{
"result_index": 0,
"results": [
{
"alternatives": [
{
"confidence": 0.994,
"transcript": "thunderstorms could produce large hail isolated tornadoes and heavy rain "
}
],
"final": true
}
]
}
Here is how I am attemption to access it.
parsed = json.loads(data)
print(parsed['results']['alternatives']['transcript'])
This results in the following error:
TypeError: list indices must be integers or slices, not str
It seems as though results is just an array with a single entry that is a string, and I am a bit confused how to access the individual elements within it.
resultsandalternativesare arrays so maybeparsed['results'][0]['alternatives'][0]['transcript']