0

I have a output like this

{
    "Tags": [
        {
            "ResourceType": "instance",
            "Value": "dev",
            "Key": "Group"
        },
        {
            "ResourceType": "instance",
            "Value": "web",
            "Key": "Name"
        }
    ]
}

With shell script, how can i get the "web" value? In other words, i only want to get the value if the "Key" equals "Name"

2
  • You didn't mention what shell you are using, but generally that'd be hard without parsing the JSON. Is it OK if your script depends on something like Node.js or PHP? Commented May 17, 2018 at 7:01
  • I use bash shell and it doesn't depend on any other things. Commented May 17, 2018 at 7:05

1 Answer 1

1

You could use jq for example:

command | jq ".Tags[1].Value"
Sign up to request clarification or add additional context in comments.

1 Comment

Since i only want to get the py-sc without double quotation marks, is there any way to do this?

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.