JQ filtering on fields in nested Objects
- The output "without commas" is a stream of JSON; to emit an array, wrap your jq filter in square brackets.
- You can abbreviate
{id: id, type: .type}
to{id, type}
- Your filter which repeats .batter[] has the effect of creating a Cartesian product. What you evidently wantinstead is to expand .batter just once.
Putting everything together:
[{id, type} + (.batter[] | {batterId: .id, batterType: .type})]