# Transform a json list

**URL:** <https://forum.ansible.com/t/transform-a-json-list/20401>\
**Category:** Ansible Project\
**Created:** [February 1, 2016, 3:20pm UTC](https://forum.ansible.com/t/transform-a-json-list/20401 "2016-02-01T15:20:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yoel](https://avatars.discourse-cdn.com/v4/letter/y/c68b51/32.png) [@Yoel](https://forum.ansible.com/u/Yoel)\
**Post date:** [February 1, 2016, 3:20pm UTC](https://forum.ansible.com/t/transform-a-json-list/20401/1 "2016-02-01T15:20:02Z")

</div>

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](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](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

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [February 1, 2016, 5:36pm UTC](https://forum.ansible.com/t/transform-a-json-list/20401/2 "2016-02-01T17:36:22Z")

</div>

You should be able to do:

{{ grafana\_datasources.json|map(attribute=‘name’) }}
