I have a file containing the data ( as obtained from Twitter4J methods like twitter.showUser()) and each of the line looks like
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='RT@upmc: Y'a-t-ilunpilotedansl'avion?Colloquiumd'#informatiquedemainsoirà18havecGillesDowek@Inria',
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=[
J@3cbd7173,
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
}
I would like to convert this data format to a plain text format with all the fields.
Thank you for the help
There are several APIs around for JSON - processing.
The new JSR-353 (part of JEE 7) could be useful to you , you could try http://www.jdom.org/
just to mention two.
Both mainly iterate over the complete JSON - Object which can be constructed from a JSON - String.
So how to want to format your text?
If you just want to put everything into a text - file you could append to a String member of your Main - class,
if you want to produce a csv -text -file
you are translating between two different views of a data model
and should build a proper data model for the csv - file before creating the view of it, the actual csv - file.