0

I am new for jq and been trying to get desired output, but without success.

So let's say I have json content like this:

{  
    "name": "jack",  
    "tags": ["1.0", "2.0"]  
}  

And I would like to get ouput like this:

jack:1.0  
jack:2.0

How to achieve that with jq?

1 Answer 1

2

Use this:

jq -r '"\(.name):\(.tags[])"' file.json
Sign up to request clarification or add additional context in comments.

1 Comment

hey can you please explain what is going on in the background to print this? looks pretty cool!

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.