I am getting tweets back from twitter now but don't know how to organize what I'm receiving. In the original XML version there is a variable "tweet", that is never defined anywhere in the channel. I cant run the channel the old (xml) way but i suspect "tweet" was a heading in the XML output from twitter. If that is so, its not there any more so I'm not sure how to replace it.
If i retrieve 2 tweets like this:
json = ParseJson(rsp)
printing "json" gives me each tweet as a seperate array like this:
<Component: roAssociativeArray>
<Component: roAssociativeArray>
I cant use PrintAA because of non-numeric index but i can write to ascii file and print that. Here is one tweet to RokuChris:
[{"created_at":"Sat Apr 06 16:12:20 +0000 2013","id":XXXX,"id_str":"XXXX","text":"@nowhereman Its working now thank you! Only issue it seems to run at 120% speed - watchable but chipmunk-y. Just me?","source":"\u003ca href=\"http:\/\/twitter.com\/download\/iphone\" rel=\"nofollow\"\u003eTwitter for iPhone\u003c\/a\u003e","truncated":false,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":XXXX,"in_reply_to_user_id_str":"XXXX","in_reply_to_screen_name":"nowhereman","user":{"id":XXXX,"id_str":"XXXX","name":"XXXX","screen_name":"XXXX","location":"","description":"","url":null,"entities":{"description":{"urls":[]}},"protected":false,"followers_count":0,"friends_count":0,"listed_count":0,"created_at":"Wed Oct 12 19:06:56 +0000 2011","favourites_count":0,"utc_offset":null,"time_zone":null,"geo_enabled":false,"verified":false,"statuses_count":3,"lang":"en","contributors_enabled":false,"is_translator":false,"profile_background_color":"C0DEED","profile_background_image_url":"http:\/\/abs.twimg.com\/images\/themes\/theme1\/bg.png","profile_background_image_url_https":"https:\/\/abs.twimg.com\/images\/themes\/theme1\/bg.png","profile_background_tile":false,"profile_image_url":"http:\/\/pbs.twimg.com\/profile_images\/3485369747\/f9369ecfc20f767fd665d7beab820ea7_normal.jpeg","profile_image_url_https":"https:\/\/pbs.twimg.com\/profile_images\/3485369747\/f9369ecfc20f767fd665d7beab820ea7_normal.jpeg","profile_link_color":"0084B4","profile_sidebar_border_color":"C0DEED","profile_sidebar_fill_color":"DDEEF6","profile_text_color":"333333","profile_use_background_image":true,"default_profile":true,"default_profile_image":false,"following":false,"follow_request_sent":false,"notifications":false},"geo":null,"coordinates":null,"place":null,"contributors":null,"retweet_count":0,"favorite_count":0,"entities":{"hashtags":[],"symbols":[],"urls":[],"user_mentions":[{"screen_name":"nowhereman","name":"Nowhere Man","id":XXXX,"id_str":"XXXX","indices":[0,11]}]},"favorited":false,"retweeted":false,"lang":"en"}]
Here is the original XML function I'm fighting with:
Function parse_status_response(xml As Object, tweetArray As Object) As Void
tweetElements = xml.GetChildElements()
tweetCount = 0
for each tweet in tweetElements
item = init_tweet_item()
item.Message = validstr(tweet.text.GetText())
item.UserName = validstr(tweet.user.screen_name.GetText())
item.ImageSource = validstr(tweet.user.profile_image_url.GetText())
tweetCount = tweetCount + 1
tweetArray.Push(item)
end for
End Function
And my current not working yet version:
Function parse_status_response(json As Object, tweetArray As Object) As Void
tweetCount = 0
for each tweet in json 'obviously wrong
item = init_tweet_item()
item.Message = validstr(tweet.text.GetText())
item.UserName = validstr(tweet.user.screen_name.GetText())
item.ImageSource = validstr(tweet.user.profile_image_url.GetText())
tweetCount = tweetCount + 1
tweetArray.Push(item)
end for
End Function
So, in order to say "for each", what do I call each "key" in that twitter output?
How to replace the "tweet" variable in the original?
Each tweet is a separate array - did it come that way when it was xml? Do i need to add some array processing here?
If my variable "json" is the entire twitter output (multiple tweets) How do i write a variable that represents each array? like Json[array] or something.
Thanks
Kinetics Screensavers