Why does json.dumps() encode emojis into unicode? See code and output below:
import json
obj = {"key": "hello "}
print(obj)
{'key': 'hello '}
print(json.dumps(obj))
'{"key": "hello \ud83d\ude00"}'
I have tried print(json.dumps(obj)).encode('utf-8')
and some variants (.decode()
...) but it didn't change the output much. Im working on Python 3.6.1