fileslurp

How to combine the sequence of objects in jq into one object?

余生颓废 提交于 2019-11-27 11:27:53
问题 I would like to convert the stream of objects: { "a": "green", "b": "white" } { "a": "red", "c": "purple" } into one object: { "a": "red", "b": "white", "c": "purple" } Also, how can I wrap the same sequence into an array? [ { "a": "green", "b": "white" }, { "a": "red", "c": "purple" } ] Sadly, the manual is seriously lacking in comprehensiveness, and googling doesn't find the answers either. 回答1: If your input is a stream of objects, then unless your jq has inputs , the objects must be