I have a text file that looks like so:
[{
"x": 0.37375009059906006,
"y": 0.858906626701355,
"y": 1.2558532880291295e-08,
},
{
"x": 0.4551462233066559,
"y": 0.8060519695281982,
"y": -0.023612480610609055,
},
{
"x": 0.5198760032653809,
"y": 0.7056148648262024,
"y": -0.0391654446721077,
},
etc, etc
And I want to know how to convert it into a proper list in python which stores the proper dictionaries.
My current code looks like this:
def create_array(type):
path = f'data/hands/{type}'
files = os.listdir(path)
data = []
for file in files:
with open(f'{path}/{file}', 'r') as f:
c_data = json.loads(f.read())
data.append(c_data)
data = [dict(x) for x in data]
print(data)
But I'm just getting this error:
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 5 column 1 (Char 82)
Anyone know how to get it working?