Parsing var created with loop

I have the following output from a variable called directories. It was created using a loop that would run stat against two different paths. What is the proper way to reference the “stat: exists: boolean” sections of the output? I need to check for both directories for both item.paths. I have tried and tried, but I must be doing something wrong.

"directories.results": [ { "_ansible_ignore_errors": null, "_ansible_item_result": true, "_ansible_no_log": false, "_ansible_parsed": true, "changed": false, "failed": false, "invocation": { "module_args": { "checksum_algorithm": "sha1", "follow": false, "get_attributes": true, "get_checksum": true, "get_md5": true, "get_mime": true, "path": "/home/applmgr/Scripts" } }, **"item": {** **"path": "/home/applmgr/Scripts"** }, "stat": { "atime": 1519330068.2478893, "attr_flags": "e", "attributes": [ "extents" ], ......lots of stuff **"exists": true,**…lots of stuff`
}
},
{
“_ansible_ignore_errors”: null,
“_ansible_item_result”: true,
“_ansible_no_log”: false,
“_ansible_parsed”: true,
“changed”: false,
“failed”: false,
“invocation”: {
“module_args”: {
“checksum_algorithm”: “sha1”,
“follow”: false,
“get_attributes”: true,
“get_checksum”: true,
“get_md5”: true,
“get_mime”: true,
“path”: “/home/oracle/Scripts”
}
},
“item”: {
“path”: “/home/oracle/Scripts”
},
“stat”: {
“exists”: false
}
}
]
}

`

It depends on what you want to do next.
The fist one is
  {{ directories.results.0.stats.exists }}
and the second one is
  {{ directories.results.1.stats.exists }}

If you need both to be true before running a task that would be

  when: directories.results.0.stats.exists and directories.results.1.stats.exists

since they are bools.

Thanks Kai. I still see a problem:

`

  • name: debug
    debug:
    var: directories.results.0.stats.exists

Result:
TASK [debug] *****************************************************************************************************************************************************************************************************************************
ok: [labebs-apps1] => {
“directories.results.0.stats.exists”: “VARIABLE IS NOT DEFINED!”
}

`

Is there any way to reference it by something more descriptive, like a name?

Sorry, syntax error. Had stats not stat.