微博获取的用户发微博json数据。我用阿里提供的 fastjson进行解析。
json数据格式如下:
{
"bi_followers_count": 0,
"domain": "",
"avatar_large": "http://tp1.sinaimg.cn/32300/180/0/0",
"ptype": 0,
"block_word": 0,
"star": 0,
"id": 32300,
"city": "9",
"verified": false,
"follow_me": false,
"verified_reason": "",
"followers_count": 11,
"location": "河北 沧州",
"mbtype": 0,
"profile_url": "uc32300",
"province": "13",
"avatar_hd": "http://tp1.sinaimg.cn/32300/180/0/0",
"statuses_count": 0,
"description": "",
"friends_count": 50,
"online_status": 0,
"mbrank": 0,
"allow_all_act_msg": false,
"profile_image_url": "http://tp1.sinaimg.cn/32300/50/0/0",
"idstr": "32300",
"allow_all_comment": true,
"geo_enabled": true,
"class": 1,
"name": "狮城夜猫201405",
"lang": "zh-cn",
"weihao": "",
"remark": "",
"favourites_count": 0,
"screen_name": "狮城夜猫201405",
"url": "",
"gender": "f",
"created_at": "Tue Feb 25 19:04:46 +0800 2014",
"verified_type": -1,
"following": false
}
{
"status": {
"reposts_count": 0,
"favorited": false,
"attitudes_count": 0,
"truncated": false,
"text": "转发微博",
"created_at": "Fri Mar 30 18:33:22 +0800 2012",
"mlevel": 0,
"visible": {
"type": 0,
"list_id": 0
},
"idstr": "3429347434629736",
"mid": "3429347434629736",
"source": "<a href=\"http://app.weibo.com/t/feed/5xCS0B\" rel=\"nofollow\">新浪微博手机版</a>",
"in_reply_to_status_id": "",
"in_reply_to_screen_name": "",
"in_reply_to_user_id": "",
"comments_count": 0,
"geo": null,
"id": 3429347434629736,
"pic_urls": []
},
"domain": "uc26776400",
"avatar_large": "http://tp1.sinaimg.cn/26776400/180/5626488822/1",
"bi_followers_count": 0,
"ptype": 0,
"block_word": 0,
"star": 0,
"id": 26776400,
"city": "6",
"verified": false,
"follow_me": false,
"verified_reason": "",
"followers_count": 12,
"location": "河北 保定",
"mbtype": 0,
"profile_url": "uc26776400",
"province": "13",
"avatar_hd": "http://tp1.sinaimg.cn/26776400/180/5626488822/1",
"statuses_count": 5,
"description": "",
"friends_count": 154,
"online_status": 0,
"mbrank": 0,
"allow_all_act_msg": false,
"profile_image_url": "http://tp1.sinaimg.cn/26776400/50/5626488822/1",
"idstr": "26776400",
"allow_all_comment": true,
"geo_enabled": true,
"class": 1,
"name": "我自大",
"lang": "zh-cn",
"weihao": "",
"remark": "",
"favourites_count": 0,
"screen_name": "我自大",
"url": "",
"gender": "m",
"created_at": "Tue Nov 10 00:34:28 +0800 2009",
"verified_type": -1,
"following": false
}
主要就是对其中的逻辑关系进行分析。[ ] 就是进行数组解析。
package com.Jason.test;
import java.util.ArrayList;
import java.util.List;
public class Status {
private Long reposts_count;
private Boolean favorited;
private Long attitudes_