【解决】JSONDecodeError: Expecting property name enclosed in double quotes

Error when reading json format file:

    Reason for the error: After the last key: value key-value pair, there is an extra comma, which is equivalent to an extra empty key-value pair, resulting in a parsing error:

with open("ccxt_config.json", 'rt') as f:
        config_info = json.load(f)

The contents of the wrong file are as follows:

{
  "rule":{
    "namespace":"strategy",
    "name":"test_exp_1496234234223400",
    "version":0,
    "last_modify_time":1434234236819000,
    "log_rate":1023300,
    "schema_version":"hello_world!"
  },
  "key":value,
}
 
 

The correct file format is as follows:

 
 
{
  "rule":{
    "namespace":"strategy",
    "name":"test_exp_1496234234223400",
    "version":0,
    "last_modify_time":1434234236819000,
    "log_rate":1023300,
    "schema_version":"hello_world!"
  },
  "key":value
}


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325853602&siteId=291194637