Quantcast
Channel: Active questions tagged jq - Stack Overflow
Viewing all articles
Browse latest Browse all 527

jq: group and key by property

$
0
0

I have a list of objects that look like this:

[  {"ip": "1.1.1.1","component": "name1"  },  {"ip": "1.1.1.2","component": "name1"  },  {"ip": "1.1.1.3","component": "name2"  },  {"ip": "1.1.1.4","component": "name2"  }]

Now I'd like to group and key that by the component and assign a list of ips to each of the components:

{"name1": ["1.1.1.1","1.1.1.2"  ]},{"name2": ["1.1.1.3","1.1.1.4"  ]}

Viewing all articles
Browse latest Browse all 527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>