I have a problem with reading my files. I got multiple JSON objects and I want to have them in one common JSON file. That is why I want to replace always these \n]\n[ by a comma. My code for doing this looks the following:
with open('name.txt', encoding="utf-8") as fp:
data = fp.read()
data = data.replace('\n]\n[', ',')
data = json.loads(data)
print(data)
However, I always get this error message although I've included the encoding in the first line:
'charmap' codec can't encode character '\U0001f60b' in position 756: character maps to
<undefined>
Can anyone please help?