I can't seem to get the syntax right to only return the array with a "Value" containing "Gaming" in a multi dimensional array.
This is what i've got so far:
msg.payload = msg.payload.Volumes.Tags.filter(el => el.Value.includes("Gaming"))
My payload returns three "Volumes" and I want to filter out one of the "Volumes"
{
"Volumes":[
{
"Attachments":[
{
"AttachTime":"2021-12-04T18:03:14.000Z",
"Device":"xvdf",
"InstanceId":"abcd",
"State":"attached",
"VolumeId":"abcd",
"DeleteOnTermination":false
}
],
"AvailabilityZone":"ca-central-1a",
"CreateTime":"2021-12-04T18:03:00.651Z",
"Encrypted":false,
"Size":125,
"SnapshotId":"abcd",
"State":"in-use",
"VolumeId":"abcd",
"Tags":[
],
"VolumeType":"sc1",
"MultiAttachEnabled":false
},
{
"Attachments":[
{
"AttachTime":"2022-01-09T01:22:44.000Z",
"Device":"/dev/sda1",
"InstanceId":"abcd",
"State":"attached",
"VolumeId":"abcd",
"DeleteOnTermination":false
}
],
"AvailabilityZone":"ca-central-1a",
"CreateTime":"2022-01-09T01:22:28.846Z",
"Encrypted":false,
"Size":30,
"SnapshotId":"",
"State":"in-use",
"VolumeId":"abcd",
"Iops":100,
"Tags":[
{
"Key":"Volume",
"Value":"GamingVolume"
}
],
"VolumeType":"gp2",
"MultiAttachEnabled":false
},
{
"Attachments":[
],
"AvailabilityZone":"ca-central-1a",
"CreateTime":"2022-01-09T03:15:01.774Z",
"Encrypted":false,
"Size":30,
"SnapshotId":"",
"State":"available",
"VolumeId":"abcd",
"Iops":100,
"Tags":[
{
"Key":"Snapshot",
"Value":"Snapshot"
}
],
"VolumeType":"gp2",
"MultiAttachEnabled":false
}
]
}