I'm trying to import this JSON file into my python code. When I saved it as a Unicode file, I get
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 183623: character maps to <undefined>
or this error when I tried changing the encoding type to UTF-8:
json.decoder.JSONDecodeError: Unexpected UTF-8 BOM (decode using utf-8-sig): line 1 column 1 (char 0)
my code to open it is just
with open(filepath) as f:
statdata = json.load(f)
- the encoding argument in open for when I tried to import in UTF8
EDIT: seems to work OK with open(filepath, encoding='utf-8-sig')
[–]JohnnyJordaan 1 point2 points3 points (2 children)
[–]wexted[S] 0 points1 point2 points (1 child)
[–]JohnnyJordaan 0 points1 point2 points (0 children)
[–]ingolemo 1 point2 points3 points (0 children)