Skip to content
Advertisement

How to Group By within Object in jq

I have this JSON Object

JavaScript

And I want an output like this

JavaScript

How do I achieve this with bash script and jq? This seems to be like a group by functionality, but I’m unable to figure it out.

Advertisement

Answer

Here’s a solution using jq’s –stream option:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement