I have a json file with some data in it.
[
{
"@timestamp": "2021-05-07 15:01:19",
"message": "hello",
"name": "hi",
"userID": "001"
},
{
"@timestamp": "2021-05-07 15:01:19",
"message": "hello",
"name": "hi",
"userID": "001"
}
]
I want to loop through it and output its content but I am getting this error:
AttributeError: 'list' object has no attribute 'values'
my code is this:
import json
with open('final_result.json') as data_file:
data = json.load(data_file)
for v in data.values():
print(v)
can somebody help me to understand why I am getting this error and how to solve it?
thank you much in advance