Monday, 10 January 2022

JQ vs jsonpath

Not sure why I'm not doing more with jsonpath but I do admire the elegance and simplicity of this: -

kubectl get service cluster-proxy -n default -o=jsonpath='{.spec.clusterIP}'

as compared to my default muscle memory using jq : -

kubectl get service cluster-proxy -n default --output JSON | jq -r .spec.clusterIP

The jsonpath alternate definitely requires fewer keystrokes AND doesn't require me to install jq 

Although, to be honest, I'm not going to stop using jq for all my other JSON wrangling ....

No comments:

TIL - read-only variables in Linux

 A co-worker was seeing an exception: -  line 8: TMOUT: readonly variable when trying to SCP a file from a remote Linux box. I did some digg...