data = json.load(jsonfile) 报错json.decoder.JSONDecodeError: Expecting value如何解决?
import json
jsonfile = open('example.json')
data = json.load(jsonfile)
print(data['string'])
代码本身并没有问题,主要是斜体样式定义的数据example.json:
{
"array": [1,2,3,4],
"boolean": True,
"object": {
"a": "b"
},
"string": "Hello World"
}
其中存在**双引号,单引号**问题。这里的True是字符串,应该加双引号
应该检查数据是否正确