Roku Developer Program

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

JSON parsing with objects named "object"

Hi all,
I have a json array with objects like the following:

{
"position": 6,
"object": {
"body": "<p>Our collection includes four Palme d'Or winners, two holders of the Caméra d'Or, two Grand Prix classics and two titles from Un Certain Regard, alongside other notable films that have caused a stir on the Croisette over the years.</p>",
"sku": null,
"plans": [],
"media_maestro_id": null,
"title": "Cannes Film Festival",
"quote": "It's just the best place to be, like a fairytale.",
"curator_playlist": false,
"lowest_amount": null,
"hierarchy_url": "collections",
"slug": "cannes-film-festival",
"quoter": "Marjane Satrapi",
"parent_id": 96,
"featured": false,
"curator_name": null,
"has_price": false,
"images": [
{
"url": null,
"position": 1,
"align": "default"
},
{
"url": null,
"position": 2,
"align": "default"
},
{
"url": null,
"position": 3,
"align": "default"
}
],
"summary": "Celebrate the Cannes Film Festival with our collection of major prize-winners and contenders from previous festivals.",
"film_count": 52,
"id": 96
},
"hero": false,
"sub_collection": false,
"content_type": "bfi collection"
}


When I print the object in the console I get:

object: <Component: roAssociativeArray>

Than I try to store this object in roAssociativeArray like so:

collectionObject = CreateObject("roAssociativeArray")
collectionobject: listItem.object

but Im getting compiler error e.g. Syntax error: unexpected token "object"

Thanks
0 Kudos
2 Replies
Highlighted
Level 7

Re: JSON parsing with objects named "object"

Using a colon is only valid when defining a literal AA, as in your first block of code. To do an assignment as you're attempting in the second block, you should use the = sign.

--Mark
0 Kudos
Highlighted
Level 7

Re: JSON parsing with objects named "object"

Great!

That fixed it!

Now I just need to ignore the Eclipse errors on the keyword "object"

Thanks,
Goran
0 Kudos