I am having a hard time converting Cyrillic symbols stored in Unicode to UTF-8 using Python's json library. The input JSON string:
data = '{"name": "\\u0431\\u0433"}'
The encoded result I am getting from json.dumps(data)
and json.dumps(data).encode('utf8')
is identical to the input, no conversion takes place.
Even more oddly, json.dumps(data, ensure_ascii=False).encode('utf8')
returns a hexadecimal result:
'{"name": "\xd0\xb1\xd0\xb3"}'
Does anyone have idea what I am doing wrong?