Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
crawfishmedia
Binge Watcher

Nested Array

Hi, I am having trouble pulling content from a nested array. Included is a sample of the data. I would like to get the array of photos, ("photos") and the "original_size" info: height, width and url, which looks like another nested array within "photos".
I have been able to get the list of posts by using:

for each post in json.response.posts

but if I change it to:

for each post in json.response.posts.photos

brightscript causes an error

So basically I am asking how do I reference the nested array within json.response.posts.photos ?

Thanks!

{
"meta": {
"status": 200,
"msg": "OK"
},
"response": {
"blog": {
"title": "title",
},
"posts": [
{
"blog_name": "blogname",
"tags": [
"london",
"fall",
"city"
],
"photos": [ {
"caption": "",
"original_size": {
"width": 960,
"height": 1280,
"url": "http://server-ip/url"
}
}]
},
0 Kudos
1 REPLY 1
EnTerr
Roku Guru

Re: Nested Array

You seem to be missing a level of nesting,
"posts": [ {
being an array of hashes. Perhaps it should be
json.response.posts[0].photos
or something like that?
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.