Re: [ansible-devel] json parsing help

2020-08-30 Thread Kevin Hoyt
awesome! thanks, I'll try it. Kevin On Sun, Aug 30, 2020 at 2:03 PM Rich Megginson wrote: > On 8/30/20 11:54 AM, Kevin Hoyt wrote: > > Hi Rich, > > I'm looking to collect the name field into a list and then use that in > further tasks. > > > Something like this: > > set_fact: > >

Re: [ansible-devel] json parsing help

2020-08-30 Thread Rich Megginson
On 8/30/20 11:54 AM, Kevin Hoyt wrote: Hi Rich, I'm looking to collect the name field into a list and then use that in further tasks. Something like this: set_fact:   keyvallist: "{{ hc_pim_info.dpListProcessesReply.dpServiceList.dpService | map(attribute='@key') | list }}" see the

Re: [ansible-devel] json parsing help

2020-08-30 Thread Kevin Hoyt
Hi Rich, I'm looking to collect the name field into a list and then use that in further tasks. Thanks, Kevin On Sun, Aug 30, 2020 at 12:51 PM Rich Megginson wrote: > > On 8/29/20 3:18 PM, Kevin Hoyt wrote: > > Ahh got it! ok, that worked. 1 more question, since that is an array at >

Re: [ansible-devel] json parsing help

2020-08-30 Thread Rich Megginson
On 8/29/20 3:18 PM, Kevin Hoyt wrote: Ahh got it!  ok, that worked.  1 more question, since that is an array at dpService, I want to iterate through that.  I tried leaving the brackets blank, but that failed.  How would I tell it to give me each element? I guess it depends on what you want

Re: [ansible-devel] json parsing help

2020-08-29 Thread Kevin Hoyt
Ahh got it! ok, that worked. 1 more question, since that is an array at dpService, I want to iterate through that. I tried leaving the brackets blank, but that failed. How would I tell it to give me each element? Thanks for the help! Kevin On Sat, Aug 29, 2020 at 3:32 PM Rich Megginson

Re: [ansible-devel] json parsing help

2020-08-29 Thread Rich Megginson
On 8/29/20 1:20 PM, Kevin Hoyt wrote: Hi John, Thank you for the response.  I just tried it and got the following error: "msg": "template error while templating string: unexpected char u'\\u2018' at 63. String: {{ hc_pim_info.dpListProcessesReply.dpServiceList.dpService[0][‘@Name’] }}" Must

Re: [ansible-devel] json parsing help

2020-08-29 Thread Kevin Hoyt
Hi John, Thank you for the response. I just tried it and got the following error: "msg": "template error while templating string: unexpected char u'\\u2018' at 63. String: {{ hc_pim_info.dpListProcessesReply.dpServiceList.dpService[0][‘@Name’] }}" It just doesn't seem to like that '@Name' at

Re: [ansible-devel] json parsing help

2020-08-29 Thread John Westcott
If I’m reading the json right, try: {{ hc_pim_info.dpListProcessesReply.dpServiceList.dpService[0][‘@Name’] }} -John Sent from my iPhone > On Aug 28, 2020, at 16:41, Kevin Hoyt wrote: > > Hi everyone, I'm just learning ansible and having some trouble parsing out > some json data. I'm

[ansible-devel] json parsing help

2020-08-28 Thread Kevin Hoyt
Hi everyone, I'm just learning ansible and having some trouble parsing out some json data. I'm hoping someone can help me. What I'm looking for is the Name field at hc_pim_info.dpListProcessesReply.dpServiceList.dpService I can get to this level, but can't get past the array and then the