【发布时间】:2015-12-01 11:08:19
【问题描述】:
我正在尝试解析有效的 JSON 文件并遇到以下错误。我还验证了我的 JSON 结构。
错误:
parseJSON = json.loads(jsonFilePath);
File "C:\Python34\lib\json\__init__.py", line 318, in loads
return _default_decoder.decode(s)
File "C:\Python34\lib\json\decoder.py", line 343, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Python34\lib\json\decoder.py", line 361, in raw_decode
raise ValueError(errmsg("Expecting value", s, err.value)) from None
ValueError: Expecting value: line 1 column 1 (char 0)
代码:
vendorID = input('ENTER the vendor ID :');
jsonFilePath="C:/Users/user/Desktop/maradata.json";
parseJSON = json.loads(jsonFilePath);
我还在这里粘贴了 JSON 数据: http://pastecode.org/index.php/view/23471909
谁能建议我在哪里遇到错误?
【问题讨论】:
-
json.loads()采用 JSON 字符串,而不是文件名。看看骗子。