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: 
youssefsherif
Streaming Star

Re: impoting data from a json file

Jump to solution
    x = 10
    for j = 0 to json.Count() - 1
        m.tile[j] = createObject("roSGNode", "Tile")
        m.tile[j].width = 300
        m.tile[j].height = 200
        m.tile[j].translation = [x, 300]
        m.tile[j].titleText = json[j].title
        m.tile[j].descriptionText = json[j].description
        m.tile[j].posterUrl = json[j].poster
        m.top.appendChild(m.tile[j])
        m.tile[j].setFocus(true)
        x += m.tile[j].width + 10


    end for

hello im sorry but i cant figure out why the code keeps crashing, the reason im doing this in an array is to use it later in the code

0 Kudos
renojim
Community Streaming Expert

Re: impoting data from a json file

Jump to solution

What error are you getting on the console?

Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.
0 Kudos
youssefsherif
Streaming Star

Re: impoting data from a json file

Jump to solution

Screenshot 2022-12-22 at 9.56.25 PM.png

0 Kudos
renojim
Community Streaming Expert

Re: impoting data from a json file

Jump to solution

You need to create the m.tile array before you start using it.  Before the for loop try adding

m.tile = []
Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.
0 Kudos
youssefsherif
Streaming Star

Re: impoting data from a json file

Jump to solution

worked perfect thank you so much again!!!

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.