Answer the question
In order to leave comments, you need to log in
How to make json_query queries correctly?
It is required using ansible to parse JSON of the following format
www.mocky.io/v2/5d4af1033300005b000f6100 Make
a request similar to
curl -s http://www.mocky.io/v2/5d4af1033300005b000f6100|jq '.[]."scopedTarget.Config.A (something in [A.cfg.yml])".fontTemplates[]|{"name"}'
How to correctly compose a request in json_query format
What are the online services where you can quickly check the request in jmespath format and immediately substitute it into the playbook?
This query returns an empty value
---
- hosts: localhost
connection: local
gather_facts: False
tasks:
- name: "Get JSON"
uri:
url: http://www.mocky.io/v2/5d4af1033300005b000f6100
body_format: json
register: json_response
- debug:
msg: "{{ json_response.json | json_query( '\"scopedTarget.Config.A (something in [A.cfg.yml])\"' ) }}"
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question