Unicode values in strings are escaped when dumping to JSON in Python

后端 未结 1 1865
盖世英雄少女心
盖世英雄少女心 2021-01-13 09:55

For example:

>>> print json.dumps(\'růže\')
\"r\\u016f\\u017ee\"

(Of course, in the real program it\'s not just a single string, a

相关标签:
1条回答
  • 2021-01-13 10:32

    Pass the ensure_ascii=False argument to json.dumps:

    >>> print json.dumps('růže', ensure_ascii=False)
    "růže"
    
    0 讨论(0)
提交回复
热议问题