Sorry i have simplified too much my example.
Here is the whole thing:
inputs_with_escaped_quotes.json :
{
"inputs": {
"value": "this is a \" escaped quoted \" \" string \" yeah..."
}
}
Tasks :
Escaped_quotes.yml :
---
- name: escaped quotes set_fact
set_fact:
jsoncode: "{{ lookup('template', 'template_with_escaped_quotes.j2') }}"
- name: Save file
local_action:
module: copy
content: "{{ jsoncode }}"
dest: "{{ role_path }}/files/output.json"
Templates template_with_escaped_quotes.j2:
{
"result_value": "{{ inputs.value }}"
}
Json result : output.json :
{
"result_value": "this is a " escaped quoted " " string " yeah..."
}
Regards
Le vendredi 20 août 2021 à 17:14:00 UTC+2, Felix Fontein a écrit :
> Hi,
>
> I tried to replicate this, but without success. The quotes were there.
> So you probably have to provide more information.
>
> > {
> >
> > inputs: {
> >
> > "value": "my \" value \" is here"
> >
> > [ .. ]
>
> Please note that it must be "inputs" for a proper JSON file. Also
> please note that the "value" line you inserted above contains some
> special invisible characters that trip up both JSON and YAML parsers.
>
> Cheers,
> Felix
>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/e542a036-a0e6-44f8-a1f7-2111a25bb703n%40googlegroups.com.