squirreltown
12 years agoRoku Guru
XML to JSON
I would like to add some twitter functionality to my channel so my first step is needing to "fix" the SDK twitterOauth example which is currently broken since Twitter upgraded their API and now uses JSON instead of XML. My question for this first function is what is the JSON equivalent of xml.GetChildElements() since what i have there is not working
And secondly Is there anything really obviously wrong with the start of this function (although the debugger wont let me get to this until the first question gets answered)
BTW the Oauth part is working fine.
Thanks
Function parse_status_response(json As Object, tweetArray As Object) As Void
tweetElements = json.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 secondly Is there anything really obviously wrong with the start of this function (although the debugger wont let me get to this until the first question gets answered)
Function show_tweet_canvas() As Void
http = NewHttp(m.prefix+"1.1/statuses/user_timeline.json?screen_name=RokuPlayer")
oa = Oauth()
oa.sign(http,false)
rsp = http.getToStringWithTimeout(10)
json = ParseJson(rsp)
tweetArray = CreateObject("roArray", 100, true)
m.ParseTweets(json, tweetArray)
-----------------------
BTW the Oauth part is working fine.
Thanks