Answers for "json loading utf-8 python"

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
0

read json file python utf8

with open('keys.json', encoding='utf-8') as fh:
    data = json.load(fh)

print(data)
# from stackoverflow : https://stackoverflow.com/questions/46408051/python-json-load-set-encoding-to-utf-8
Posted by: Guest on February-22-2021

Python Answers by Framework

Browse Popular Code Answers by Language