我一直在努力,当我在网址栏中输入使用API有以下回应:API/JSON值错误
{
"resource": "playerdashptshotlog",
"parameters": {
"LeagueID": "00",
"Season": "2014-15",
"SeasonType": "Regular Season",
"PlayerID": 202066,
"TeamID": 0,
"Outcome": null,
"Location": null,
"Month": 0,
"SeasonSegment": null,
"DateFrom": null,
"DateTo": null,
"OpponentTeamID": 0,
"VsConference": null,
"VsDivision": null,
"GameSegment": null,
"Period": 0,
"LastNGames": 0
},
"resultSets": [
我的代码如下:
import json, requests
github_url = 'http:dsds
parsed_input = json.loads(github_url)
print (parameters.keys())
print (parameters['LeagueID']['Season'])
我得到
Traceback (most recent call last): File "C:\Python34\Scripts\NBA API-JSON.py", line 27, in parsed_input = json.loads(github_url) 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)
当我在Python27运行它,我得到这个错误:当我使用Python34说错误
Traceback (most recent call last): File "C:\Python27\Scripts\NBA API-JSON.py", line 27, in parsed_input = json.loads(github_url) File "C:\Python27\lib\json__init__.py", line 338, in loads return _default_decoder.decode(s) File "C:\Python27\lib\json\decoder.py", line 366, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "C:\Python27\lib\json\decoder.py", line 384, in raw_decode raise ValueError("No JSON object could be decoded") ValueError: No JSON object could be decoded
我想弄清楚我做错了什么。我试图用一个例子回答我发现在发现一个问题:
Parsing Multidimensional JSON Array
你不能复制所有的回应,因为你粘贴的内容无效JSON,它以开放的结束'[ ' – Victory
大约60页的价值 –