Skip to content
This repository was archived by the owner on Oct 28, 2022. It is now read-only.
Roman Dodin edited this page Feb 24, 2021 · 3 revisions

To display only the key-value pairs where value is a string:

jq '.[].updates[].values|to_entries[].value | map_values(strings)|keys'

this is helpful to identify which keys need a convertion to int/float if the target supports only json. Interactive example: https://jqplay.org/s/xXJ-NkYOR4

Display only the values of the Get/Subscribe response

https://jqplay.org/s/276Is6LUgS

alias onlyval="jq '.[].updates[].values|to_entries[].value'"

gnmic -a clab-lacp-sr1 -u admin -p admin --insecure \
      get --path /state/system/platform | onlyval
Get Response:
"7750 SR-1"