EDIT: I have seen all of the questions on SA for this and they all give me the error I'm asking about here- please can you leave it open so I can get some help?
I have a file I can read very simply with Bash like this:
gzip -d -c my_file.json.gz | jq .
This confirms that it is valid JSON. But when I try to read it using Python like so:
import json
import gzip
with gzip.open('my_file.json.gz') as f:
data = f.read() # returns a byte string `b'`
json.loads(data)
I get the error:
json.decoder.JSONDecodeError: Extra data: line 2 column 1 (char 1632)
But I know it is valid JSON from my Bash command. I have been stuck on this seemingly simple problem for a long time now and have tried everything it feels like. Can anyone help? Thank you.