Can't access json key in it.

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: