I'm getting json data from REST API having the structure below. The data provides me a list of data having dict structure and having ids. I want to access specific data just by using the id e.g data['x1234']
. But I couldn't because each time I have to iterate over the list and checking ids or ending having sth like this data["body"][0]["id"]
. How can I solve the issue?
{
body:
[{
id: x1234,
name: a1,
....
},
{
id: b1234,
name: b1,
....
}]
}
I just want to extract particular object with id having a value b1234 so data["b1234"] returns the following output:
{
id: b1234,
name: b1,
....
}