# Can't access json key in it.

**URL:** <https://forum.ansible.com/t/cant-access-json-key-in-it/24449>\
**Category:** Ansible Project\
**Created:** [May 10, 2017, 3:42pm UTC](https://forum.ansible.com/t/cant-access-json-key-in-it/24449 "2017-05-10T15:42:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![VenomMsk](https://avatars.discourse-cdn.com/v4/letter/v/eb9ed0/32.png) [@VenomMsk](https://forum.ansible.com/u/VenomMsk)\
**Post date:** [May 10, 2017, 3:42pm UTC](https://forum.ansible.com/t/cant-access-json-key-in-it/24449/1 "2017-05-10T15:42:11Z")

</div>

Hi,

I get an array of JSON object and I need to extract all “ssl-listening-port” from it. I can get an array of the smallest structure, that contains this key:

> - name: Debug  
> debug:  
> msg: “{{ port\_raw\_list | json\_query(m\_filter)}}”  
> #msg: “{{ filter }}”  
> vars:  
> m\_filter: “results[\*].json”

> ok: [rn1] =\> {  
> “changed”: false,  
> “msg”: [  
> {  
> “ssl-listening-port”: [  
> “7234”  
> ]  
> },  
> {  
> “ssl-listening-port”: [  
> “7235”  
> ]  
> },  
> {  
> “ssl-listening-port”: [  
> “7236”  
> ]  
> }  
> ]  
> }

But I can’t access the array of values. Setting filter to results[\*].json.ssl-listening-port is not allowed, cause it contains dashes are not allowed, but using the breckets doesn’t help either. The following code

- name: Debug  
debug:  
msg: “{{ port\_raw\_list | json\_query(m\_filter)}}”  
#msg: “{{ filter }}”  
vars:  
m\_filter: “results[\*].json[‘ssl-listening-port’]”

results following errors:
