I have a output of curl | jq:
{ "ssh_keys": [ { "id": 30482248, "fingerprint": "21:57:08:d8:41:0f:89:57:0b:96:95:64:ff:59:50:69", "public_key": "ssh-rsa AAAA [email protected]", "name": "User's key" }, { "id": 30450573, "fingerprint": "27:0c:2e:34:63:00:13:9d:5c:26:44:15:f0:cf:15:13", "public_key": "ssh-rsa AAAA-VirtualBox", "name": "test1" }, { "id": 30485316, "fingerprint": "28:63:11:6b:a0:c7:ae:e1:e7:98:0b:01:96:c2:f4:87", "public_key": "ssh-rsa AAAA lessons", "name": "rbm-mykey" } ], "links": { "pages": { "last": "https://api.digitalocean.com/v2/account/keys?page=3", "next": "https://api.digitalocean.com/v2/account/keys?page=2" } }, "meta": { "total": 59 } } I want to return "public_key" that have value with "User's key" from "name" key, so the result should be
"ssh-rsa AAAA [email protected]" I tried the command:
curl -X GET -H "Authorization: Bearer " "https://api.digitalocean.com/v2/account/keys?page=1" | jq '.[] | .[] | .name' But recieved only values of "name" key