From ccd2420eff3bc23c3f215a6a12cd31aa671644a2 Mon Sep 17 00:00:00 2001 From: Michele Cereda Date: Wed, 20 Apr 2022 21:00:28 +0200 Subject: [PATCH] Added jsonpath notes to the knowledge base --- knowledge base/jsonpath.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 knowledge base/jsonpath.md diff --git a/knowledge base/jsonpath.md b/knowledge base/jsonpath.md new file mode 100644 index 0000000..d0d2734 --- /dev/null +++ b/knowledge base/jsonpath.md @@ -0,0 +1,16 @@ +# JSONPath + +## TL;DR + +```shell +# filter elements +# only works on arrays, not on maps +kubectl get serviceaccounts \ + -o jsonpath="{.items[?(@.metadata.name!='default')].metadata.name}" +``` + +## Further readings + +- [JSONPath Syntax] + +[jsonpath syntax]: https://support.smartbear.com/alertsite/docs/monitors/api/endpoint/jsonpath.html