How to create a list from a hash

Hi,

I have got this hash

ok: [localhost] => {
“msg”: {
“123”: “hostname1”,
“345”: “hostname2”
}
}

I would like to create a new list from the above hash which contains only the values .

  • hostname1
  • hostname2

When I use variable.keys() I get the first fields I would like all the second fields in a new list. Is this possible?

I got the hash after using combine().

Regards,
Abey

Something like this:

values: "{{ msg | json_query('*') }}"

Hi Dick,

Thanks. That worked.

ok: [localhost] => {
“msg”: [
“hostname1”,
“hostname1”
]
}

Never used JMESPath until now!

Abey