title: Ansible variable substitution issues in JSON file
body: <p>I have a JSON file with the user details using which I want to create a user. It all works fine if everything in JSON is plain text. However I want to keep the password in the Ansible vault and read it from there in to my JSON. However when I load the file, the variable is not being substituted with the password. I can print the password variable which printed the password in plain text.</p>
  
  <p>I need to supply user details as a JSON object to one of the API which creates the user with that info. My password is in the ansible vault. I have a variable with the ansible hash for this password. My JSON file looks as below.</p>
  
  <pre><code>{"Users":
          [
              {  
                "databaseName" : "admin",
                "roles" : [ {    
                  "databaseName" : "admin",
                  "roleName" : "readAnyDatabase"
                } ],
                "username" : "AnsibleReadUser",
                "password" : "{{ apikey }}"
              },
              {  
                "databaseName" : "admin",
                "roles" : [ {    
                  "databaseName" : "admin",
                  "roleName" : "readWriteAnyDatabase"
                } ],
                "username" : "AnsibleReadWriteUser",
                "password" : "{{ apikey }}"
              }
          ]
  }
  </code></pre>
  
  <p>Here is my ansible task to load the JSON file.</p>
  
  <pre><code>- name: Load Input files
    set_fact:
      userinfo_json: "{{ lookup('file', 'UserDetails.json') | from_json }}"
  </code></pre>
  
  <p>When I print the content of 'userinfo_json' the variable is not substituted.</p>
  
  <pre><code> "msg": "UserDetails JSON: {'Users': [{'databaseName': 'admin', 'roles': [{'databaseName': 'admin', 'roleName': 'readAnyDatabase'}], 'username': 'AnsibleReadUser', 'password': '{{ apikey }}'}, {'databaseName': 'admin', 'roles': [{'databaseName': 'admin', 'roleName': 'readWriteAnyDatabase'}], 'username': 'AnsibleReadWriteUser', 'password': '{{ apikey }}'}]}"
  }
  </code></pre>
  
  <p>I want the {{ apikey }}' to be replaced with the variable value.</p>
  
  <pre><code>{"Users":
          [
              {  
                "databaseName" : "admin",
                "roles" : [ {    
                  "databaseName" : "admin",
                  "roleName" : "readAnyDatabase"
                } ],
                "username" : "AnsibleReadUser",
                "password" : "Password"
              },
              {  
                "databaseName" : "admin",
                "roles" : [ {    
                  "databaseName" : "admin",
                  "roleName" : "readWriteAnyDatabase"
                } ],
                "username" : "AnsibleReadWriteUser",
                "password" : "Password"
              }
          ]
  }
  </code></pre>