goranch
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2015
05:53 AM
JSON parsing with objects named "object"
Hi all,
I have a json array with objects like the following:
When I print the object in the console I get:
object: <Component: roAssociativeArray>
Than I try to store this object in roAssociativeArray like so:
but Im getting compiler error e.g. Syntax error: unexpected token "object"
Thanks
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
2 REPLIES 2

RokuMarkn
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2015
07:50 AM
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
--Mark
goranch
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2015
08:23 AM
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
That fixed it!
Now I just need to ignore the Eclipse errors on the keyword "object"
Thanks,
Goran