1

I have the following json file:

 {
     "HostedZones": [
         {
             "Id": "Z3JX6LQV6IJO3E",
             "Name": "sandbox.mydomain.com."
         },
         {
             "Id": "Z13M9NFG2E4J5N",
             "Name": "internal.mydomain.com."
         }
     ]
 }

I am using jq and want to get the "Id" value of the object where 'Name' is 'internal.mydomain.com.'.

0

1 Answer 1

1

Use select() filter on the name and get the id value with the following filter

jq '.HostedZones[] | select (.Name=="internal.mydomain.com.").Id'
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.