简体   繁体   中英

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?

用这个:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM