You can have gcutil output into JSON format instead of tabular format by using the --format
flag (see gcutil --help):
--format: <table|sparse|json|csv|names>: Format for command output. Options include:
table: formatted table output
sparse: simpler table output
json: raw json output (formerly --print_json)
csv: csv format with header
names: list of resource names only, no header
(default: 'table')
For example:
gcutil --format=json getinstance instance-test
Combine this with the jq for easy, powerful commands:
$ gcutil --format=json --service_version=v1 --project="<project>" \
--zone="<zone>" getinstance "<instance>" | jq '.metadata.kind'
"compute#metadata"