Skip to content

Instantly share code, notes, and snippets.

@darktempla
Last active June 12, 2023 10:28
Show Gist options
  • Save darktempla/a5fbc0c55cbcc23c513b42536ce529ce to your computer and use it in GitHub Desktop.
Save darktempla/a5fbc0c55cbcc23c513b42536ce529ce to your computer and use it in GitHub Desktop.
Extract a value from a JSON payload that contains a dot in the key name using the JQ command line tool
# the leading '.' in the dockerconfigfile key we are interested in
# makes the syntax harder then it should be, pay attention to the syntax used here
kubectl get secret/regcred -o json | jq -r '.data[".dockerconfigjson"]' | base64 -d
# OR
kubectl get secret/regcred -o jsonapath="{.data.\.dockerconfigjson}" | base64 -d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment