Transform a json list

Hi,

my variable contains this Json

“grafana_datasources.json”: [
{
“access”: “proxy”,
“basicAuth”: false,
“basicAuthPassword”: “”,
“basicAuthUser”: “”,
“database”: “databaseName”,
“id”: 2,
“isDefault”: false,
“jsonData”: null,
“name”: “InfluxDB1”,
“orgId”: 1,
“password”: “user”,
“type”: “influxdb”,
“url”: “http://localhost:8086”,
“user”: “myUser”
},

{
“access”: “proxy”,
“basicAuth”: false,
“basicAuthPassword”: “”,
“basicAuthUser”: “”,
“database”: “databaseName2”,
“id”: 3,
“isDefault”: false,
“jsonData”: null,
“name”: “InfluxDB2”,
“orgId”: 1,
“password”: “user”,
“type”: “influxdb”,
“url”: “http://localhost:8086”,
“user”: “myUser2”
}

]

How can i extract a list of “name attribute” ?

Expected = [“InfluxDB1”, “InfluxDB2”]
I’m using ansible 1.9.2

Thanks,

Yoel

You should be able to do:

{{ grafana_datasources.json|map(attribute=‘name’) }}