运行json.load(f)加载已存储好的json文件时,出现如下报错:
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 2 column 5 (char 6)
网上试了很多方法都不管用
最后发现是因为存储的json文件里有注释:
{
// configs of target dataset (for clean-tuning and test)
"target_dataset":{
"name": "sst-2", // dataset name
"load": false, // load existing poisoned data
"dev_rate": 0.1 // ratio of dev set
}
解决方法:
- 删掉注释
- 换用json5,即json5.load()