json

https://docs.python.org/3/library/json.html

Table of Contents

Write JSON data to a file howto

import json
with open('data.json', 'w') as f:
    json.dump(data, f, ensure_ascii=False)

Dump an object as a JSON with preserving unicode(no \u things) howto

import json
print(json.dumps('안녕', ensure_ascii=True))
print(json.dumps('안녕', ensure_ascii=False))
"\uc548\ub155"
"안녕"