I have multiple JSON Files with the same structure , the list is the array.
$ jq 'keys' file_1.json
[
"itemsPerPage",
"links",
"list",
"startIndex"
]
the list field looks like this
file1.json
"list" : [ {"id: 123, "fname":"SAM" }, {"id: 125, "fname":"JOE" } .....]
fileX.json
"list" : [ {"id: 783, "fname":"Danny" }, {"id: 785, "fname":"Kingmo" } .....]
trying to generate an output as follows (Only List and Ignoring other fields which are itemsPerPage/links/startIndex)
"list" : [ {"id: 123, "fname":"SAM" }, {"id: 125, "fname":"JOE" }, {"id: 783, "fname":"Danny" }, {"id: 785, "fname":"Kingmo" }]
what's the best way to read all those files in with jq and generate a single file with one list array that has all the objects from all the JSON files ?