title: how to read json file using ansible
body: <p>I have a json file in the same directory where my ansible script is. Following is the content of json file:</p>
  
  <pre><code>{ "resources":[
             {"name":"package1", "downloadURL":"path-to-file1" },
             {"name":"package2", "downloadURL": "path-to-file2"}
     ]
  }
  </code></pre>
  
  <p>I am trying to to download these packages using get_url. Following is the approach:</p>
  
  <pre><code>---
  - hosts: localhost
    vars:
      package_dir: "/var/opt/"
      version_file: "{{lookup('file','/home/shasha/devOps/tests/packageFile.json')}}"
  
    tasks:
      - name: Printing the file.
        debug: msg="{{version_file}}"
  
      - name: Downloading the packages.
        get_url: url="{{item.downloadURL}}" dest="{{package_dir}}" mode=0777
        with_items: version_file.resources
  </code></pre>
  
  <p>The first task is printing the content of the file correctly but in the second task, I am getting the following error:</p>
  
  <pre><code>[DEPRECATION WARNING]: Skipping task due to undefined attribute, in the future this
  will be a fatal error.. This feature will be removed in a future release. Deprecation
  warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
  </code></pre>