I have a JSON/dictionary object in Python that looks like the following:
object = {"participants":
[
{"name": "Tyler", "role": "CEO"},
{"name": "Robin", "role": "analyst"}
{"name": "James", "role": "manager"}
]
}
Given a persons name, how do I access their role? As the role is not a "sub-information" of the name, you can't just do something like
object['participants']['Tyler']['role']
or something. You don't know the index of the specific person either (I presume you can make a loop that finds it if that is the only solution), so you can't just do
object['participants'][0]['role']
either, just because Tyler here happens to be at index 0.