新浪微博登陆时的JSON数据读取,急!
帮忙看看
做新浪账号登陆时通过https://api.weibo.com/2/users/show.json获得用户数据
格式是JSON如下,保存在temp中,怎么用asp读取screen_name的值呢?
{
"id": 1904178193,
"idstr": "1904178193",
"screen_name": "微博开放平台",
"name": "微博开放平台",
"province": "11",
"city": "8",
"location": "北京 海淀区",
"description": "#平台沙龙两周年#每期沙龙都离不开热爱平台的朋友们,您是否记得2010年10月初次相聚,我们一起见证平台启程;两年间,平台与开发者一同发...",
"url": "",
"profile_image_url": "http://tp2.sinaimg.cn/1904178193/50/5610154048/0",
"profile_url": "openapi",
"domain": "openapi",
"weihao": "",
"gender": "f",
"followers_count": 63987,
"friends_count": 48,
"statuses_count": 1051,
"favourites_count": 2,
"created_at": "Mon Dec 27 17:56:46 +0800 2010",
"following": false,
"allow_all_act_msg": false,
"geo_enabled": true,
"verified": true,
"verified_type": 2,
"remark": "",
"status": {
"created_at": "Tue Feb 26 14:23:23 +0800 2013",
"id": 3549959669956621,
"mid": "3549959669956621",
"idstr": "3549959669956621",
"text": "#轻松一刻#今天是2013年2月26日 星期二,宜1、写单元测试(写单元测试将减少出错)2、重构(代码质量得到提高)http://t.cn/zYGFIFz",
"source": "<a href=\"http://app.weibo.com/t/feed/1sxHP2\" rel=\"nofollow\">专业版微博</a>",
"favorited": false,
"truncated": false,
"in_reply_to_status_id": "",
"in_reply_to_user_id": "",
"in_reply_to_screen_name": "",
"pic_ids": [
"717f7411jw1e26scd15ykj"
],
"thumbnail_pic": "http://ww1.sinaimg.cn/thumbnail/717f7411jw1e26scd15ykj.jpg",
"bmiddle_pic": "http://ww1.sinaimg.cn/bmiddle/717f7411jw1e26scd15ykj.jpg",
"original_pic": "http://ww1.sinaimg.cn/large/717f7411jw1e26scd15ykj.jpg",
"geo": null,
"reposts_count": 0,
"comments_count": 0,
"attitudes_count": 0,
"mlevel": 0,
"visible": {
"type": 0,
"list_id": 0
}
},
"allow_all_comment": false,
"avatar_large": "http://tp2.sinaimg.cn/1904178193/180/5610154048/0",
"verified_reason": "新浪微博开放平台",
"follow_me": false,
"online_status": 0,
"bi_followers_count": 40,
"lang": "zh-cn",
"star": 0,
"mbtype": 0,
"mbrank": 0,
"block_word": 0
}
------解决方案--------------------asp解析JSON还真不好弄,直接字符串截取就行了吧。。
function kv(s,key)
key=""""&key&""":"""
dim iStart,iEnd
iStart=instr(s,key)
if iStart=0 then exit function
iStart=iStart+len(key)
iEnd=instr(iStart,s,"""")
kv=mid(s,iStart,iEnd-iStart)
end function
response.write kv(temp,"screen_name")
------解决方案--------------------这个就只能自己写一个函数了
参考如下(来自网络):