How combine multiple output objects into a single object with jq How combine multiple output objects into a single object with jq json json

How combine multiple output objects into a single object with jq


Using map_values produces a simpler (or at least shorter) filter, and might be more efficient:

.modules | map(.outputs | map_values(.value) ) | add


I ended up finding a solution but it took way longer than it should have (hours). Basically if at any time you lose the , in your lists than you messed up somewhere.

This is what I used .modules | map(.outputs | to_entries[] | {(.key): .value.value}) | add

It works, but maybe a better way.