Parse specific output from json with jq

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?

Upvotes: 0

Views: 84

Answers (1)

hek2mgl
hek2mgl

Reputation: 158180

Use this:

jq -r '"\(.name):\(.tags[])"' file.json

Upvotes: 2

Related Questions