Jq

From Halfface
Revision as of 08:13, 5 May 2023 by Ekaanbj (talk | contribs) (Created page with "=create list of all keys in array.= curl -sk -H "Authorization: Bearer $(oc whoami -t)" https://$(oc get routes -n openshift-monitoring thanos-querier -o jsonpath='{.status.ingress[0].host}')/api/v1/metadata | jq . echo '{ "data": { "aggregator_openapi_v2_regeneration_count": [ { "unit": "" } ], "alertmanager_alerts": [ { "unit": "" } ] } }' | jq -r '.data | keys | flatten[]' /tmp/tmp.json aggre...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

create list of all keys in array.

curl -sk -H "Authorization: Bearer $(oc whoami -t)" https://$(oc get routes -n openshift-monitoring thanos-querier -o jsonpath='{.status.ingress[0].host}')/api/v1/metadata | jq .
echo '{
  "data": {
    "aggregator_openapi_v2_regeneration_count": [
      {
        "unit": ""
       }
    ],
    "alertmanager_alerts": [
      {
        "unit": ""
      }
    ]
  }
}' | jq -r '.data | keys | flatten[]' /tmp/tmp.json
aggregator_openapi_v2_regeneration_count
alertmanager_alerts