Slurp it up with the -s
option.
$ jq -s '.' <<< '{ "a": 1 } { "b": 2 }'
[
{
"a": 1
},
{
"b": 2
}
]
As another option, reading the values using inputs
is a much more flexible alternative. You’ll usually want to use this in conjunction with the -n
option to prevent the first value from being consumed prematurely.
$ jq -n '[inputs]' <<< '{ "a": 1 } { "b": 2 }'