I have a python 3 script that should get some data from a .csv-file and write it to a json file. During my processing the encoding is correct, so that german umlauts ü, ä or degree sign ° are like they are (# coding=cp1252 at the head).
But when I write the dict via json.dump() the encoding is gone...
How can I write a dict to a json file with the correct encoding?
# -*- coding: cp1252 -*-
import json
from pandas import read_csv
x={"äö": "ü°"}
print(x, json.dumps(x, indent=4))
>>>> {'äö': 'ü°'} {"\u00e4\u00f6": "\u00fc\u00b0"}