这是我的JSON数据:
{
"id": "474676675993584",
"about": "Official Facebook Page of GITM IEEE Society.\nWe are based out of Gurgaon Institute of Technology and Management, Gurgaon.",
"can_post": false,
"category": "Organization",
"category_list": [
{
"id": "198503866828628",
"name": "Organization"
}
],
"checkins": 24,
"country_page_likes": 478,
"cover":
{
"cover_id": "601076406686943",
"offset_x": 0,
"offset_y": 28,
"source": "https://scontent.xx.fbcdn.net/hphotos-xtp1/t31.0-8/s720x720/10321662_601076406686943_419719677923907...",
"id": "601076406686943"
},
"has_added_app": false,
"is_community_page": false,
"is_published": true,
"new_like_count": 3,
"likes": 478,
"link": "https://www.facebook.com/ieeegitm",
"location":
{
"city": "Gurgaon",
"country": "India",
"latitude": 28.288555,
"longitude": 76.860245,
"street": "Gurgaon Institute Of Technology & Management,Bilaspur-Tauru Road, Gurgaon (Haryana)",
"zip": "122413"
},
"name": "GITM IEEE",
"offer_eligible": true,
"parking":
{
"lot": 0,
"street": 0,
"valet": 0
},
"promotion_eligible": true,
"talking_about_count": 2,
"unread_message_count": 0,
"unread_notif_count": 1,
"unseen_message_count": 0,
"username": "ieeegitm",
"were_here_count": 24
}
当我尝试对此执行json.loads
时,它会给我错误:
File "<stdin>", line 1, in <module> File "/usr/lib/python2.7/json/__init__.py", line 338, in loads
return _default_decoder.decode(s)
File "/usr/lib/python2.7/json/decoder.py", line 366,in decode obj,
end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python2.7/json/decoder.py", line 382, in raw_decode obj,
end = self.scan_once(s, idx)
ValueError: Expecting property name: line 2 column 1 (char 2)
答案 0 :(得分:0)
我觉得你有一些额外的角色, 检查此工具:http://json.parser.online.fr/
我删除了多余的字符,我将它们从unicode解码为十六进制,这是字符代码:E28082。
顺便说一下,我用空格''替换它。
{
"id": "474676675993584",
"about": "Official Facebook Page of GITM IEEE Society.\nWe are based out of Gurgaon Institute of Technology and Management, Gurgaon.",
"can_post": false,
"category": "Organization",
"category_list":[{
"id": "198503866828628",
"name": "Organization"}],
"checkins": 24,
"country_page_likes": 478,
"cover":
{
"cover_id": "601076406686943",
"offset_x": 0,
"offset_y": 28,
"source": "https://scontent.xx.fbcdn.net/hphotos-xtp1/t31.0-8/s720x720/10321662_601076406686943_419719677923907...",
"id": "601076406686943"
},
"has_added_app": false,
"is_community_page": false,
"is_published": true,
"new_like_count": 3,
"likes": 478,
"link": "https://www.facebook.com/ieeegitm",
"location":
{
"city": "Gurgaon",
"country": "India",
"latitude": 28.288555,
"longitude": 76.860245,
"street": "Gurgaon Institute Of Technology & Management,Bilaspur-Tauru Road, Gurgaon (Haryana)",
"zip": "122413"
},
"name": "GITM IEEE",
"offer_eligible": true,
"parking":
{
"lot": 0,
"street": 0,
"valet": 0
}, "promotion_eligible": true,
"talking_about_count": 2,
"unread_message_count": 0,
"unread_notif_count": 1,
"unseen_message_count": 0,
"username": "ieeegitm",
"were_here_count": 24
}
如果您想亲自查看角色,请将其复制并粘贴到记事本++中以显示它们。