Search code examples
jsonsyntaxkeyjq

jq: error: canonical/0 is not defined at <top-level>, line 1. Not able to read \ in json using jq


{
    "labels": {
                    "chart": "boss",
                    "heritage": "back",
                    "istio": "gw",
                    "released": "istio",
                    "service.istio.io/canonical-name": "istio"
                }
}

This is my json. I would like to read the below key value using jq. .labels.released : i am getting the value of istio.
similarly i would like to read "service.istio.io/canonical-name" this key. But getting the error of jq: error: canonical/0 is not defined at , line 1:


Solution

  • jq '.labels["service.istio.io/canonical-name"]'