python2

python json转字符串保留中文

python3

python json转字符串保留中文

源码解释

If ensure_ascii is false, then the return value can contain non-ASCII characters if they appear in strings contained in obj. Otherwise, all such characters are escaped in JSON strings.
如果ensure_ascii为false,那么返回值可以包含非ascii字符。
否则,所有这些字符都在JSON字符串中转义。

相关文章: