Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
ajitg_4557
Level 7

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
squirreltown
Level 8

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
Level 7

Re: How to create this structure using roArray and roAssociativeArray

thanks for your reply squirreltown.
0 Kudos