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: 
ajitg_4557
Channel Surfer

How to create this structure using roArray and roAssociativeArray

Structure Like this:-

data = {
"device": "roku",
   {
     "movie_id": 12,
     "watch_seconds": 3,
     "collected_at": "06/19/2018"
   },
   {
     "movie_id": 33,
     "watch_seconds": 1,
     "collected_at": "06/19/2018"
   },
]
}


parent_AA=CreateObject("roAssociativeArray")
Child_Arr=CreateObject("roArray", 10, true)
Child_AA=CreateObject("roAssociativeArray")
for i=0 to 10
Child_AA.AddReplace("one"+i,"i")
Child_Arr.push(Child_AA)
end for
parent_AA.devices = "Roku"
parent_AA.Append(Child_Arr)
print"parent_AA=======>>>>>"parent_AA


i am trying like this but it does not seem like as i want.
please look in it, and help.
thanks to all.
0 Kudos
2 REPLIES 2
squirreltown
Roku Guru

Re: How to create this structure using roArray and roAssociativeArray

     "movie_id": 33,
     "watch_seconds": 1,
     "collected_at": "06/19/2018"
   }

Shouldn't be a coma after the last "}"



data = {
 "device": "roku",
 "metrics": []
}

data.metrics.push(  {

    "movie_id": 12,
    "watch_seconds": 3,
    "collected_at": "06/19/2018"

  } )

data.metrics.push(  {  
    "movie_id": 33,
    "watch_seconds": 1,
    "collected_at": "06/19/2018"
  } )
Kinetics Screensavers
0 Kudos
ajitg_4557
Channel Surfer

Re: How to create this structure using roArray and roAssociativeArray

thanks for your reply squirreltown.
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.