title: Getting attribute value using Ansible filters
body: <p>I am trying to get my attribute value from JSON data.</p>
  
  <p>Here is my JSON data:</p>
  
  <pre><code>{
     "user1": "{\n \"data\":[\n    {\n     \"secure\": [\n       {\n              \"key\": \"-----BEGIN  KEY-----\nMIIEowIBAAKCAQEAgOh+Afb0oQEnvHifHuzBwhCP3\n-----END KEY-----\"\n       }\n      ],\n     \"owner\": \"shallake\",\n     \"position\": \"gl\"\n    }\n   ]\n}"
  }
  </code></pre>
  
  <p>Initially, I had invalid JSON data, so I converted it into valid JSON using <code>to_json</code> and <code>from_json</code>. The above JSON data is the result that I get.</p>
  
  <p>code:</p>
  
  <pre><code> - set_fact:
        user: "{{ lookup('file','filepath/myfile.json') | to_json }}"
  
   - set_fact:
        user1: "{{ user | from_json}}"
  
   - set_fact:
        user3: "{{ item }}"
     with_items: "{{ user1['data'] | map(attribute='position') | list }}"
  </code></pre>
  
  <p>In a third <code>set_fact</code>, I am trying to get position attribute value. But it shows an error like this:</p>
  
  <blockquote>
    <p>the field 'args' has an invalid value, which appears to include a variable that is undefined. The error was: 'item' is undefined</p>
    
    <p>"\"{\n \\"data\\":[\n    {\n     \\"secure\\": [\n       {\n         \\"key\\": \\"-----BEGINPRIVATE KEY-----\nMIIEowIBAAKCAQEAgOh+Afb0oQEnvHifHuzBwl+Tiu8LXoJXb/ii/eh\ngYEP3\n-----END PRIVATE KEY-----\\"\n       }\n      ],\n     \\"owner\\": \\"shalloke\\",\n     \\"position\\": \\"gl\\"\n    }\n   ]\n}\n\n\""</p>
  </blockquote>
  
  <p>So how can I get a position value from the above JSON data result using Ansible loop?</p>