1

Input:

{"aa":["a1","a2"]}
{"bb":["a1","b2"]}

Wanted output (no worries about potentially duplicate keys):

{
  "aa":["a1","a2"],
  "bb":["b1","b2"]
}

Many thanks!

type
  • 1,137
  • 2
  • 9
  • 16

1 Answers1

1

The simplest would undoubtedly be to use the invocation:

jq -s add

If the input stream is extremely large, it might be better to use reduction, e.g.:

jq -n 'reduce inputs as $i ({}; . + $i)'
peak
  • 105,803
  • 17
  • 152
  • 177