twitter4j-无法使用GSON或TwitterObjectFactory.createStatus(jsonStr)反序列化状态

时间:2018-11-06 16:03:15

标签: java twitter gson twitter4j

无法从已保存的status.json文件创建Status

试图使用TwitterObjectFactory.createStatus(jsonStr)从json文件建立状态,而api的响应却完全相同,因此设置为null的字段太多,而其他对象也为null

比我尝试使用GSON设置状态要高,但是我不能,因为我需要提供一个“ status” .class,但是Status是一个接口,而StatusJSONImpl对于一些缺少的Http东西

有人可以帮助我建立地位吗?我认为这是一个错误,如果可以的话,您能建议我如何提高门票吗?该网页似乎无法正常工作

这是json:

{
  "createdAt": "May 23, 2018 12:55:51 AM",
  "id": 999076405488078852,
  "text": "How drones could help save lives at sea t.co/swuZmvbVwQ",
  "displayTextRangeStart": 0,
  "displayTextRangeEnd": 63,
  "source": "\u003ca href\u003d\"socialflow.com\" rel\u003d\"nofollow\"\u003eSocialFlow\u003c/a\u003e",
  "isTruncated": false,
  "inReplyToStatusId": -1,
  "inReplyToUserId": -1,
  "isFavorited": false,
  "isRetweeted": false,
  "favoriteCount": 13,
  "retweetCount": 14,
  "isPossiblySensitive": false,
  "lang": "en",
  "contributorsIDs": [],
  "userMentionEntities": [],
  "urlEntities": [
    {
      "url": "t.co/swuZmvbVwQ",
      "expandedURL": "bbc.in/2GH0nZM",
      "displayURL": "bbc.in/2GH0nZM",
      "start": 40,
      "end": 63
    }
  ],
  "hashtagEntities": [],
  "mediaEntities": [],
  "symbolEntities": [],
  "currentUserRetweetId": -1,
  "user": {
    "id": 621583,
    "name": "BBC Technology",
    "screenName": "BBCTech",
    "location": "London, UK",
    "description": "The official account for the BBC News technology team.",
    "descriptionURLEntities": [],
    "urlEntity": {
      "url": "t.co/xBkUyADpLc",
      "expandedURL": "bbc.co.uk/technology",
      "displayURL": "bbc.co.uk/technology",
      "start": 0,
      "end": 22
    },
    "isContributorsEnabled": false,
    "profileImageUrl": "pbs.twimg.com/profile_images/875790917554192384/hJQ1TsVW_normal.jpg",
    "profileImageUrlHttps": "pbs.twimg.com/profile_images/875790917554192384/hJQ1TsVW_normal.jpg",
    "isDefaultProfileImage": false,
    "url": "t.co/xBkUyADpLc",
    "isProtected": false,
    "followersCount": 752846,
    "profileBackgroundColor": "FFFFFF",
    "profileTextColor": "5A5A5A",
    "profileLinkColor": "1F527B",
    "profileSidebarFillColor": "FFFFFF",
    "profileSidebarBorderColor": "CCCCCC",
    "profileUseBackgroundImage": true,
    "isDefaultProfile": false,
    "showAllInlineMedia": false,
    "friendsCount": 60,
    "createdAt": "Jan 10, 2007 12:41:22 PM",
    "favouritesCount": 16,
    "utcOffset": -1,
    "profileBackgroundImageUrl": "abs.twimg.com/images/themes/theme1/bg.png",
    "profileBackgroundImageUrlHttps": "abs.twimg.com/images/themes/theme1/bg.png",
    "profileBannerImageUrl": "pbs.twimg.com/profile_banners/621583/1452083550",
    "profileBackgroundTiled": false,
    "lang": "en",
    "statusesCount": 29253,
    "isGeoEnabled": false,
    "isVerified": true,
    "translator": false,
    "listedCount": 14936,
    "isFollowRequestSent": false
  },
  "quotedStatusId": -1
}

0 个答案:

没有答案