jq: output array of json objects [duplicate] jq: output array of json objects [duplicate] bash bash

jq: output array of json objects [duplicate]


Use slurp mode:

  o   --slurp/-s:      Instead of running the filter for each JSON object      in the input, read the entire input stream into a large      array and run the filter just once.
$ jq -s '.' < tmp.json[  {    "name": "John",    "email": "john@company.com"  },  {    "name": "Brad",    "email": "brad@company.com"  }]