Ansible Filter json query: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 9: | Line 9: | ||
=Use Cases= | =Use Cases= | ||
====Selecting Individual Map Fields from a List of Maps==== | ====Selecting Individual Map Fields from a List of Maps==== | ||
Produce a list: | |||
<syntaxhighlight lang='yaml'> | <syntaxhighlight lang='yaml'> | ||
"{{ find_result.files | json_query('[*].path') }}" | "{{ find_result.files | json_query('[*].path') }}" | ||
</syntaxhighlight> | </syntaxhighlight> | ||
To apply a regular expression to each element of the list, see: {{Internal|Ansible_Filter_regex_replace#Apply_the_Regular_Expression_to_Each_Element_of_a_List|Apply <code>regex_replace</code> to Each Element of a List}} |
Revision as of 09:14, 5 July 2021
External
Internal
Overview
Use Cases
Selecting Individual Map Fields from a List of Maps
Produce a list:
"{{ find_result.files | json_query('[*].path') }}"
To apply a regular expression to each element of the list, see: