May-31-2019, 08:26 PM
The error is because you are trying to access something in a list as if its a dict.
data is a list with a single item in that's a dict.
if you was to print data you would get the following
data is a list with a single item in that's a dict.
if you was to print data you would get the following
... data = json.load(json_file) print(data) ...
Output:[{'dateTime': '02/27/15 00:00:00', 'value': {'date': '02/27/15', 'value': 75.0, 'error': 9.0}}]
you need to iterate data directly and then use the 'dateTime'
key on each iterated item.