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..."
}