Read json in python after encoding it

前端 未结 2 1304
南旧
南旧 2021-01-27 17:52

I have a json file that fails loading when I use the following code:

indices_json_path = \'file.json\'
with open(indices_json_path) as json_data:
    d = json.lo         


        
2条回答
  •  梦毁少年i
    2021-01-27 17:57

    This solved the problem:

    with io.open(indices_json_path,'r', encoding='UTF-16-LE') as json_data:
        d = json.load(json_data)
    

提交回复
热议问题