In an ansible task I am trying to break a long JSON string in a HTTP POST request into multiple lines based on:
I have tried:
- name: "Test POST request" uri: url: "{{ HOST }}/api/" method: POST return_content: yes body: >- "{\"id\":\"{{ app_id }}\", \"name\":\"prefix-{{ name }}\", \"type\":\"ds\", \"typeLogoUrl\":\"\", \"access\":\"all\", \"url\":\"{{ HOST_URL }}", \"password\":\"\", \"user\":\"\", \"database\":\"\", \"jsonData\":{\"a\":\"{{ a_var }}\",\"b\":true,\"c\":\"{{ c_var }}\"}, \"secureJsonFields\":{}}" body_format: json user: "{{ user }}" password: "{{ password }}" force_basic_auth: yes headers: Content-Type: application/json
But when I run it I get errors, summarized below:
[{\"classification\":\"DeserializationError\",\"message\":\"invalid character '\\\\n' in string literal\"}
Any suggestion on how to break this down into multiple without above error?