Exclude column from jq json output

If you just want to delete the timestamps you can use the del() function:

jq 'del(.[].timestamp)' input.json

However to achieve the desired output, I would not use the del() function. Since you know which fields should appear in output, you can simply populate an array with group and id and then use the join() function:

jq -r '.[]|[.group,.uid]|join(",")' input.json

-r stands for raw ouput. jq will not print quotes around the values.

Output:

employees,elgalu
employees,mike
services,pacts

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)