title: ansible problem with single quote, double quote in uri body
body: <p>I have a problem with the correct syntax to address an API with absolutely don't understands any json arguments.
  In the body must be exactly one value in this form '[&quot;XXXX&quot;]' so that it works.</p>
  <pre><code> - uri:
       url: &quot;{{ AssociatePolicies_url }}&quot;
       method: POST
       return_content: yes
       validate_certs: no
       body_format: form-urlencoded
       body: 
         apiKey: &quot;{{ apiKey }}&quot;
         ASSIGNED_POLICIES: '[&quot;XXXX&quot;]'
         RESOURCEID: &quot;{{ resourceId }}&quot;
         RUNCOMPCHECK_STATUS: true
       headers:
         Content-Type: &quot;application/x-www-form-urlencoded;charset=UTF-8&quot;
  </code></pre>
  <p>but when I pass the value now as variable i don't get it in the correct form</p>
  <pre><code>---
  - name: Post to API
    hosts: KingKong
    connection: local
    gather_facts: no
    vars:
      policygroup: 
        - XXXX
  #      - YYYY
  #      - ZZZZ
    tasks:
    - uri:
        url: &quot;{{ AssociatePolicies_url }}&quot;
        method: POST
        return_content: yes
        validate_certs: no
        body_format: form-urlencoded
        body: 
          apiKey: &quot;{{ apiKey }}&quot;
          ASSIGNED_POLICIES:  &quot;'[&quot;{{ item }}&quot;]'&quot;
          RESOURCEID: &quot;{{ resourceId }}&quot;
          RUNCOMPCHECK_STATUS: true
       headers:
         Content-Type: &quot;application/x-www-form-urlencoded;charset=UTF-8&quot;
     with_items: &quot;{{ policygroup }}&quot;
  </code></pre>
  <p>Is the response: Error while parsing ASSIGNED_POLICIES json data</p>
  <p>After various approaches I don't get any closer to the result:</p>
  <pre><code>ASSIGNED_POLICIES: &quot;\'[{{ item }}]\'&quot;       is the format '[XXXX]
  ASSIGNED_POLICIES: \'[&quot;{{ item }}&quot;]\'       is the format \\'[\&quot;XXXX\&quot;]\\'
  ASSIGNED_POLICIES: &quot;\'[\&quot;{{ item }}\&quot;]\'&quot;   is the format '[\&quot;XXXX\&quot;]'
  ASSIGNED_POLICIES: &quot;\'[&quot;{{ item }}&quot;]\'&quot;     playbook error
  ASSIGNED_POLICIES: &quot;\'[{{ \&quot; }}{{ item }}{{\&quot;}}]\'&quot; is the format '[ }}{{ item }}{{]'&quot;}]
  </code></pre>
  <p>where I get almost closer to the format is:</p>
  <pre><code>ASSIGNED_POLICIES: &quot;\'['{{ item }}']\'&quot; is the format &quot;'['XXXX']'&quot;
  </code></pre>
  <p>but with single quote in front anb ack of XXXX but there must be double quote.</p>
  <p>Maybe one of you has a creative idea</p>