3 ms·
Oh man. That's when knowing more about the tools you are using comes in handy. Kubectl has native JSONPath support [0]. Or at the very least, use structured ou
by dfinninger 6y ago
Oh man. That's when knowing more about the tools you are using comes in handy. Kubectl has native JSONPath support [0].
Or at the very least, use structured output with "-o json" and jq [1], like they mention in the article.
I have always found that trying to parse JSON with native shell tools has been difficult and error-prone.
[0] https://kubernetes.io/docs/reference/kubectl/jsonpath/ https://kubernetes.io/docs/reference/kubectl/jsonpath/
[1] https://stedolan.github.io/jq/ https://stedolan.github.io/jq/