我有包含數據(如從Twitter4J方法如twitter.showUser()中獲得)的文件,並且每個線的樣子解析與內部JSON twitter4j數據的文件爲純文本
UserJSONImpl{
id=182857317,
name='Inria',
screenName='Inria',
location='France',
description='Institutderechercheensciencesdu#numérique,
ducôtédesinventeurs#informatique#mathématiques#innovation[
compteofficiel
]',
isContributorsEnabled=false,
profileImageUrl='',
profileImageUrlHttps='',
url='',
isProtected=false,
followersCount=10171,
status=StatusJSONImpl{
createdAt=MonOct2118: 56: 17CEST2013,
id=392333528358088704,
text='[email protected]: Y'a-t-ilunpilotedansl'avion?Colloquiumd'#informatiquedemainsoirà[email protected]',
source='<ahref=""rel="nofollow">TweetDeck</a>',
isTruncated=false,
inReplyToStatusId=-1,
inReplyToUserId=-1,
isFavorited=false,
inReplyToScreenName='null',
geoLocation=null,
place=null,
retweetCount=3,
isPossiblySensitive=false,
contributorsIDs=[
[email protected],
retweetedStatus=null,
userMentionEntities=[
UserMentionEntityJSONImpl{
name='UPMC-Paris',
screenName='upmc',
id=19063270
},
UserMentionEntityJSONImpl{
name='Inria',
screenName='Inria',
id=182857317
}
],
urlEntities=[
URLEntityJSONImpl{
url='',
expandedURL='',
displayURL=''
}
],
hashtagEntities=[
HashtagEntityJSONImpl{
text='informatique'
}
],
mediaEntities=[
],
currentUserRetweetId=-1,
user=null
},
profileBackgroundColor='FFFFFF',
profileTextColor='343434',
profileLinkColor='AAAAAA',
profileSidebarFillColor='BDBDBD',
profileSidebarBorderColor='FFFFFF',
profileUseBackgroundImage=true,
showAllInlineMedia=false,
friendsCount=1209,
createdAt=WedAug2517: 30: 06CEST2010,
favouritesCount=927,
utcOffset=7200,
timeZone='Paris',
profileBackgroundImageUrl='',
profileBackgroundImageUrlHttps='',
profileBackgroundTiled=false,
lang='fr',
statusesCount=2783,
isGeoEnabled=false,
isVerified=false,
translator=false,
listedCount=544,
isFollowRequestSent=false
}
我會如將這種數據格式轉換爲純文本格式的所有字段。
感謝您的幫助
這看起來像是對象的'toString'表示,如果您可以在接收結果時以需要的格式編寫它,那將會更好。雖然我猜這在這裏是不可能的,因爲你已經積累了數據? – Jonathan
是的,這是不可能的,而且數據的大小也是非常巨大的。這就是爲什麼我正在尋找解決方案來改變它。現在,我正在解析字符串以獲取JSON格式。任何進一步的建議,讚賞。 – user156379