I want to open a JSON file using Python in my project, but I constantly get the following error:
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
This is the code:
import json
with open("../data.txt") as json_file:
data = json.load(json_file)
I have a really simple text file with JSON formatted data in it. This is the data.txt
file:
{
"data": [
{
"day": "22/04/2020 15:35",
"viewcount": "1"
},
{
"day": "22/04/2020 20:51",
"viewcount": "2"
}
]
}