can't read custom facts with list (array) of items
<p>i have created custom fact ---> /etc/ansible/facts.d/hdfs.fact</p>

<p>when i'm running the playbook with the following command</p>

<pre><code> - debug: var=ansible_local.hdfs
   run_once: true
</code></pre>

<p>i'm getting as expected the following answer:</p>

<pre><code>PLAY [all] *********************************************************************

TASK [setup] *******************************************************************
ok: [cdh-2]
ok: [cdh-3]
ok: [cdh-1]

TASK [preparation : debug] *****************************************************
ok: [cdh-1] =&gt; {
    "ansible_local.hdfs": {
        "items": [
            {
                "base": true,
                "config": {
                    "items": []
                },
                "displayName": "Failover Controller Default Group",
                "name": "hdfs-FAILOVERCONTROLLER-BASE",
                "roleType": "FAILOVERCONTROLLER",
                "serviceRef": {
                    "clusterName": "cluster",
                    "serviceName": "hdfs"
                }
            },
            {
                "base": true,
                "config": {
                    "items": [
                        {
                            "name": "balancer_java_heapsize",
                            "value": "491782144"
                        }
                    ]
                },
                "displayName": "Balancer Default Group",
                "name": "hdfs-BALANCER-BASE",
                "roleType": "BALANCER",
                "serviceRef": {
                    "clusterName": "cluster",
                    "serviceName": "hdfs"
                }
            },
            {
                "base": true,
                "config": {
                    "items": []
                },
                "displayName": "HttpFS Default Group",
                "name": "hdfs-HTTPFS-BASE",
                "roleType": "HTTPFS",
                "serviceRef": {
                    "clusterName": "cluster",
                    "serviceName": "hdfs"
                }
            }
        ]
    }
}
</code></pre>

<p>my question in how can i parse specific value from that json.
I already tried many syntax without any success</p>

<pre><code>debug: var=ansible_local.hdfs.items[0].config.displayName
debug: var=ansible_local.hdfs.items.config.displayName
</code></pre>

<p>hdfs.fact content:</p>

<pre><code>{
  "items" : [ {
    "name" : "hdfs-FAILOVERCONTROLLER-BASE",
    "displayName" : "Failover Controller Default Group",
    "roleType" : "FAILOVERCONTROLLER",
    "base" : true,
    "serviceRef" : {
      "clusterName" : "cluster",
      "serviceName" : "hdfs"
    },
    "config" : {
      "items" : [ ]
    }
  }, {
    "name" : "hdfs-BALANCER-BASE",
    "displayName" : "Balancer Default Group",
    "roleType" : "BALANCER",
    "base" : true,
    "serviceRef" : {
      "clusterName" : "cluster",
      "serviceName" : "hdfs"
    },
    "config" : {
      "items" : [ {
        "name" : "balancer_java_heapsize",
        "value" : "491782144"
      } ]
    }
  }, {
    "name" : "hdfs-HTTPFS-BASE",
    "displayName" : "HttpFS Default Group",
    "roleType" : "HTTPFS",
    "base" : true,
    "serviceRef" : {
      "clusterName" : "cluster",
      "serviceName" : "hdfs"
    },
    "config" : {
      "items" : [ ]
    }
  } ]
}
</code></pre>

<p>thanks </p>