# Ansible work with array

**URL:** <https://forum.ansible.com/t/ansible-work-with-array/23545>\
**Category:** Ansible Project\
**Created:** [January 24, 2017, 8:20am UTC](https://forum.ansible.com/t/ansible-work-with-array/23545 "2017-01-24T08:20:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stepan\_Harutyunyan](https://avatars.discourse-cdn.com/v4/letter/s/d9b06d/32.png) [@Stepan\_Harutyunyan](https://forum.ansible.com/u/Stepan_Harutyunyan)\
**Post date:** [January 24, 2017, 8:20am UTC](https://forum.ansible.com/t/ansible-work-with-array/23545/1 "2017-01-24T08:20:34Z")

</div>

Hi Everyone,

Hear is some part of my ansible code, I want to take severety from Json array when contactAccount is [someemail2@somedomain.com](mailto:someemail2@somedomain.com), but I got following error:

FAILED! =\> {“failed”: true, “msg”: “‘thresholds’ is undefined”}

I tried to change {{ thresholds }} to {{ array.customRules.thresholds }} or {{ item.0.customRules.thresholds }} , but again got errors, could anyone help me?

\*\*- name: create files shell: echo "{{ item.1.\*\ ***severity**  **}}" \>\> /opt/testing**  
**with\_subelements: - “{{ array }}” - “{{ thresholds }}”**

Hear is array example:

[  
{  
“contactAccount”: “[someemail1@somedomain.com](mailto:someemail1@somedomain.com)”,“hasWarning”: false,“customRules”: {“thresholds”: [{“severity”: “3”,“monitorId”: “1234”,},{“severity”: “4”,“monitorId”: “2345”}  
]}  
**},**

{  
“contactAccount”: “[someemail2@somedomain.com](mailto:someemail2@somedomain.com)”,“hasWarning”: false,“customRules”: {“thresholds”: [{“severity”: “30”,“monitorId”: “16234”,},{“severity”: “7”,“monitorId”: “23845”}  
]}  
**},**

**. . .**

{  
“contactAccount”: “[someemail100@somedomain.com](mailto:someemail100@somedomain.com)”,“hasWarning”: false,“customRules”: {“thresholds”: [{“severity”: “4”,“monitorId”: “1734”,},{“severity”: “46”,“monitorId”: “2845”}  
]}  
**}**

]
