Here’s an example of referencing a key with a space in its name when using OPENJSON(). I have an Ansible task that makes a URI request to a website to get a JSON response.
I'm trying to loop on a custom dictionary in ansible in order to check some mount points on a linux server, and I'm a little bit in trouble finding the correct solution, find below my playbook right now: - name: Check lvm devs hosts: localhost vars: vgos: vgroot fsconfiguration: - /: lvm. Especially if those special characters are in the key names, and you need to reference those key names.įor example, you could have a key name that contains a space (like "first name"), or a dollar sign ( $).įortunately, any time you reference such keys, you can simply surround the key name with double quotes. use a variable inside jsonquery in ansible/jinja. You can use the Ansible-specific filters documented here to manipulate your data, or use any of the standard filters shipped with Jinja2 - see the list of built-in filters in the. To select a single element or a data subset from a complex data structure in JSON format (for example, Ansible facts), use the jsonquery filter.
type: any: required: true: expr: description: - The. positional: expr: options: input: description: - The JSON data to query. If you’re using a T-SQL function such as OPENJSON(), JSON_QUERY(), or JSON_VALUE(), you might be wary of any non-alphanumeric characters that might be in the JSON document that you’re working with. Filters let you transform JSON data into YAML data, split a URL to extract the hostname, get the SHA1 hash of a string, add or multiply integers, and much more. name: jsonquery: shortdescription: Select a single element or a data subset from a complex data structure: description: - This filter lets you query a complex JSON structure and iterate over it using a loop structure.