<p>I am trying to get the podname from the pod json using the command which is returning the error</p>
<pre><code>kgp -o jsonpath=&quot;{.items[*].metadata[?(@.labels.module=='ddvv-script')].name}&quot;
</code></pre>
<p>Error</p>
<pre><code> is not array or slice and cannot be filtered. Printing more information for debugging the template:
        template was:
                {.items[*].metadata[?(@.labels.module=='ddvv-script')].name}
        object given to jsonpath engine was:
</code></pre>
<p>Sample file</p>
<pre><code>{
    &quot;apiVersion&quot;: &quot;v1&quot;,
    &quot;items&quot;: [
        {
            &quot;apiVersion&quot;: &quot;v1&quot;,
            &quot;kind&quot;: &quot;Pod&quot;,
            &quot;metadata&quot;: {
                &quot;creationTimestamp&quot;: &quot;2020-09-18T17:42:50Z&quot;,
                &quot;generateName&quot;: &quot;ddvv-script-6b784db6bd-&quot;,
                &quot;labels&quot;: {
                    &quot;app&quot;: &quot;my-configs&quot;,
                    &quot;lf.module&quot;: &quot;ddvv-script&quot;,
                    &quot;module&quot;: &quot;ddvv-script&quot;,
                    &quot;pod-template-hash&quot;: &quot;6b784db6bd&quot;,
                    &quot;release&quot;: &quot;config&quot;
                },
                &quot;name&quot;: &quot;ddvv-script-6b784db6bd-rjtgh&quot;,
</code></pre>
<p>What is wrong with this command</p>

<p>You can use below command. It gets podname of pods which has label <code>module=ddvv-script</code></p>
<pre><code>kubectl get pods --selector=module=ddvv-script --output=jsonpath={.items..metadata.name}
</code></pre>
