I have code which read data from JSON file
i = 0
while i < 10:
with open('output/{}.json'.format(i), 'r') as jsonFile:
jsonObject = json.load(jsonFile)
jsonData = jsonObject["attributes"]
jsonFile.close()
for x in jsonData:
keys = x.values()
#print(keys)
price = x["price"]
print(price)
Question: How can I return the sum of price?
PS My JSON file
{
"attributes": [
{
"trait_type": "Background",
"value": "brown",
"price": 35
},
{
"trait_type": "Rock",
"value": "red",
"price": 100
},
{
"trait_type": "Apron",
"value": "white",
"price": 100
}
]
}
