Forum Discussion
crawfishmedia
12 years agoBinge Watcher
"RokuMarkn" wrote:
Right, you can only Append() an roArray to another roArray. It doesn't make sense to append an AA (what are you appending, the keys or the values?). You should iterate the AA and Push the values you want.
--Mark
What I am trying to do is take my JSON response, and extract only the data I want. The way I currently understand this is that I need to have an array of associative arrays, which will be loaded as content metadata into the roSlideshow. Whether I push or append my associative array ssContentAA into the ssContentA array at location , the output of the final array is all the same data. I verified I am looping through the JSON data and loading it into each ssContentAA okay, by printing each iteration. The problem I am not able to overcome is that each location in the ssContentA array is the same. Here is my latest code:
ssContentA = CreateObject("roArray", json.response.liked_posts.count(), true)
ssContentAA = CreateObject("roAssociativeArray")
print "[INFO] Preparing Slideshow"
for i=0 to json.response.liked_posts.count()-1
blogname = json.response.liked_posts.blog_name
ssURL = json.response.liked_posts.photos[0].original_size.url 'only get the first photo for now
' replace the current entry with new data
ssContentAA["TextOverlayBody"] = blogname
ssContentAA["url"] = ssURL
' print the photo we saved
print "Photo";i
print ssContentAA.TextOverlayBody;" : ";ssContentAA.url
ssContentA = ssContentAA ' load aa onto a playlist
end for
print "[TEST] Testing content arrays..."
print "[TEST]";ssContentA.Count();" Items in ssContentA"
for i=0 to ssContentA.Count()-1
print "photo";i
for each key in ssContentAA
print key;" =";ssContentAA[key]
end for
end for
The data in all 20 entries in the ssContentA array are the same. I don't understand. Sorry to be a pita, but please what am I doing wrong?
Also this is how I am loading my slideshow:
ss = CreateObject("roSlideShow")
ss.SetMessagePort(port)
ss.SetPeriod(10)
ss.SetContentList(ssContentA)
ss.Show()