1

Desired output:

'{"a": "йцукен"}'

I tried this:

>>> import json
>>> json.dumps({'a': 'йцукен'})
'{"a": "\\u0439\\u0446\\u0443\\u043a\\u0435\\u043d"}'

How can I avoid these U-codes and print normal symbols?

I am using Python 3.

Fomalhaut
  • 8,590
  • 8
  • 51
  • 95
  • Possibly related: [Saving utf-8 texts in json.dumps as UTF8, not as \u escape sequence](https://stackoverflow.com/questions/18337407/saving-utf-8-texts-in-json-dumps-as-utf8-not-as-u-escape-sequence) – Lafexlos Jan 26 '18 at 10:31

1 Answers1

1

You can use the ensure_ascii keyword argument as shown here:

json.dumps({'a': 'йцукен'}, ensure_ascii=False)
James Wilson
  • 852
  • 13
  • 29