# ansible assign variable from json array

**URL:** <https://forum.ansible.com/t/ansible-assign-variable-from-json-array/24733>\
**Category:** Ansible Project\
**Created:** [June 15, 2017, 11:42am UTC](https://forum.ansible.com/t/ansible-assign-variable-from-json-array/24733 "2017-06-15T11:42:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![omar\_sheriff](https://avatars.discourse-cdn.com/v4/letter/o/3ab097/32.png) [@omar\_sheriff](https://forum.ansible.com/u/omar_sheriff)\
**Post date:** [June 15, 2017, 11:42am UTC](https://forum.ansible.com/t/ansible-assign-variable-from-json-array/24733/1 "2017-06-15T11:42:04Z")

</div>

my playbook and json file

{  
“Tomcat”: {  
“Instance”: [  
{  
“name”: “devops”,  
“uid”: “jbosscfg”,  
“gid”: “staff”,  
“dept”: “tech”,  
“recipient”: “[test@example.com](mailto:test@example.com)”,  
“shutdown\_port”: 8005,  
“http\_port”: 8080,  
“https\_port”: 8043,  
“ajp\_port”: 8009  
},  
{  
“name”: “devops1”,  
“uid”: “jbwebcfg”,  
“gid”: “staff”,  
“dept”: “hr”,  
“recipient”: “[test@example.com](mailto:test@example.com)”,  
“shutdown\_port”: 8105,  
“http\_port”: 8180,  
“https\_port”: 8143,  
“ajp\_port”: 8109  
},  
{  
“name”: “devops2”,  
“uid”: “jbosscfg”,  
“gid”: “staff”,  
“dept”: “fin”,  
“recipient”: “[test@example.com](mailto:test@example.com)”,  
“shutdown\_port”: 8205,  
“http\_port”: 8280,  
“https\_port”: 8243,  
“ajp\_port”: 8209  
}  
]  
}  
}
