Answers for "python write in json utf-8"

1

python json dump utf8

data = { 
  "name": "foo",
  "age": 27
}
with open("test.json", 'w', encoding='utf8') as outfile:
    json.dump(data, outfile, indent=2)
Posted by: Guest on June-22-2021
1

python write json to file utf8

open(jsonfile , "w", encoding="utf8").write(json.dumps(file,indent=4, ensure_ascii=False))
Posted by: Guest on November-25-2020

Python Answers by Framework

Browse Popular Code Answers by Language