import json if __name__ == "__main__": payload = '{"abc" : "あいうえお"}' x = json.loads(payload) print(x) print(type(x)) y = json.dumps(x, ensure_ascii=False) print(y) print(type(y))
実行結果
{'abc': 'あいうえお'} <class 'dict'> {"abc": "あいうえお"} <class 'str'>
ensure_ascii=False
を指定しましょう。
json — JSON encoder and decoder — Python 3.9.2 documentation
If ensure_ascii is true (the default), the output is guaranteed to have all incoming non-ASCII characters escaped. If ensure_ascii is false, these characters will be output as-is.