我有以下json,直接来自http://www.jquery4u.com/json/twitter-json-example/:
{"results":[
{"text":"@twitterapi http:\/\/tinyurl.com\/ctrefg",
"to_user_id":396524,
"to_user":"TwitterAPI",
"from_user":"jkoum",
"metadata":
{
"result_type":"popular",
"recent_retweets": 109
},
"id":1478555574,
"from_user_id":1833773,
"iso_language_code":"nl",
"since_id":0,
"max_id":1480307926,
"refresh_url":"?since_id=1480307926&q=%40twitterapi",
"results_per_page":15,
"next_page":"?page=2&max_id=1480307926&q=%40twitterapi",
"completed_in":0.031704,
"page":1,
"query":"%40twitterapi"}
}
python中的以下错误:
ValueError: No JSON object could be decoded
我的json对象出了什么问题?
我正在使用python附带的标准json包
答案 0 :(得分:1)
结果参数缺少结束时间。
使用this验证您的JSON对象
答案 1 :(得分:1)
你错过了底部的结束]
,这将有效
{
"results": [
{
"text": "@twitterapi http://tinyurl.com/ctrefg",
"to_user_id": 396524,
"to_user": "TwitterAPI",
"from_user": "jkoum",
"metadata": {
"result_type": "popular",
"recent_retweets": 109
},
"id": 1478555574,
"from_user_id": 1833773,
"iso_language_code": "nl",
"since_id": 0,
"max_id": 1480307926,
"refresh_url": "?since_id=1480307926&q=%40twitterapi",
"results_per_page": 15,
"next_page": "?page=2&max_id=1480307926&q=%40twitterapi",
"completed_in": 0.031704,
"page": 1,
"query": "%40twitterapi"
}
]
}