I have read on many examples here already on SO. Unfortunately, I keep getting this error,
Error:
json.decoder.JSONDecodeError: Expecting ',' delimiter: line 1 column 43 (char 42)
json file:
{"people": [{"name": "Scott", "from": "Nebraska", "website": "stackabuse.com"}, {"name": "Larry", "from": "Michigan", "website": "google.com"}, {"name": "Tim", "from": "Alabama", "website": "apple.com"}]}
And another separate json file:
{"scores":[{"name":"Larry","result":["0":"24","1":"43","2":"56"]},{"name":"Tim","result":["0":"44","1":"29","2":"34"]}]}
python code:
with open('data.json') as file:
data = json.load(file)
print(data)
Your JSON is invalid, it has :
tokens in an array:
"result": ["0": "24", "1": "43", "2": "56"]
# ^ ^ ^
and
"result": ["0": "44", "1": "29", "2": "34"]
# ^ ^ ^
Fix your JSON input; either replace those colons with commas, remove the "0":
, "1":
, and "2":
'indices', or replace the [...]
array brackets with {...}
JSON object braces.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With