I have a below json array file with out object. How do I parse it in python. I would like to construct all dataNomTime into a array.
[{
"id": 8916,
"objectPaths": ["/thmo/help"],
"dataTime": 1464961203,
"dataNomTime": 1464818400,
"dataEndTime": 1464904800,
"attribs": null
}, {
"id": 8917,
"objectPaths": ["/thmo/help"],
"dataTime": 1464961203,
"dataNomTime": 1464818400,
"dataEndTime": 1464904800,
"attribs": null
}]
My code
import json
from pprint import pprint
with open('file.json') as data_file:
data = json.load(data_file)
#pprint(data)
pprint(data["dataNomTime"])
Exception
pprint(data["dataNomTime"])
TypeError: list indices must be integers, not str