How will you access one label of a node that returns a list of object `k get no . . .

Adewale Olaoye:
How will you access one label of a node that returns a list of object

k get nodes -o jsonpath='{.items[*].metadata.labels}' | jq returns

{
  "<http://beta.kubernetes.io/arch|beta.kubernetes.io/arch>": "arm64",
  "<http://beta.kubernetes.io/os|beta.kubernetes.io/os>": "linux",
  "<http://kubernetes.io/arch|kubernetes.io/arch>": "arm64",
  "<http://kubernetes.io/hostname|kubernetes.io/hostname>": "minikube",
  "<http://kubernetes.io/os|kubernetes.io/os>": "linux",
  "<http://minikube.k8s.io/commit|minikube.k8s.io/commit>": "08896fd1dc362c097c925146c4a0d0dac715ace0",
  "<http://minikube.k8s.io/name|minikube.k8s.io/name>": "minikube",
  "<http://minikube.k8s.io/primary|minikube.k8s.io/primary>": "true",
  "<http://minikube.k8s.io/updated_at|minikube.k8s.io/updated_at>": "2023_04_30T15_04_18_0700",
  "<http://minikube.k8s.io/version|minikube.k8s.io/version>": "v1.30.1",
  "<http://node-role.kubernetes.io/control-plane|node-role.kubernetes.io/control-plane>": "",
  "<http://node.kubernetes.io/exclude-from-external-load-balancers|node.kubernetes.io/exclude-from-external-load-balancers>": ""
}

and I want to select say "<http://beta.kubernetes.io/arch|beta.kubernetes.io/arch>" to return the value arm64

I have tried accessing it using the array method

k get nodes -o jsonpath='{.items[*].metadata.labels["<http://beta.kubernetes.io/arch|beta.kubernetes.io/arch>"]}' but it throws an error

Ramanjireddy Atla:
k get nodes -o jsonpath='{.items[*].<http://metadata.labels.kubernetes.io/arch}|metadata.labels.kubernetes.io/arch}>' @Adewale Olaoye

Adewale Olaoye:
Yeah, I’ve tried this before asking the question.
In plain sight, this seems to be the answer, but it returns nothing

maybe because of the “/” @Ramanjireddy Atla @codeapp_denis

codeapp_denis:
try to escape the \. kubectl get nodes -o jsonpath='{.items[*].metadata.labels.beta\.kubernetes\.io/arch}'

Adewale Olaoye:
Yeah, Thanks @codeapp_denis, the escape worked