I have an array of users and each user has couple of roles. The example of the array is shown below.
[
{
id: 1,
username: 'john',
roles: [
{id: 500, name: 'Admin'},
{id: 501, name: 'Owner'}
]
},
{
id: 2,
username: 'joe',
roles: [
{id: 500, name: 'Admin'},
]
},
{
id: 3,
username: 'june',
roles: [
{id: 502, name: 'User'},
]
}
]
I'm trying to get all the users who have an Admin role by using jmesPath. I've tried [?roles[].name=='Admin']
but this is giving a null
value. Is is possible to do this with jmesPath, and if yes can you give me an expression for this example?