[Solved] json.decoder.JSONDecodeError: Extra data: line 1 column 3 (char 2)

The reason for the error is that the JSON file is too large. Read it in a single line instead

with open("COCO_train.json", "r+") as f:
    data = json.load(f)

to:

with open("COCO_train.json", "r+") as f:
    data = f.readline()

Similar Posts: