Accessing a dictionary from an array of dictionaries

ilovecomputers's icon

Here's an example JSON/dict structure:

{
    "first": {
        "list": [
            {
                "second": "value"
            }
        ]
    }
}

Now my JSON doesn't look like that, but the example gets to the heart of the matter: get-ing "value". When I message my dict:

get first::list[0]

I of course receive a pointer to another dictionary. However, when I message my dict:

get first::list[0]::second

I don't receive the string "value" as anticipated, instead I get nothing at all. So what message am I supposed to return to dict in order to get the string "value"?

Luigi Castelli's icon

Hi there,

you are right... I get the same behavior.
It seems it is not possible to get values from lists of dictionaries.

You might have found a bug or a limitation of the [dict] object.
I would report it as a bug to the C74 folks and see what they say...

- Luigi

Rob Ramirez's icon

check my reply here. this may help your situation:
https://cycling74.com/forums/javascript-dict-get-somethingelse