How to merge 2 or more json files into one array for all using terminal? Use jq!
Navigate to the directory, and run this jq command.
|
1 |
jq -s '[.[][]]'*.json > manifest.json |
Using the -s option will return an array containing the contents of the input JSON files, which, in your case, are also arrays. This means that you need to spread (…[]) two array levels, and collect ([…]) the result.
Download jq here
Looking for more information on how to use jq? Try the jq tag on StackOverflow
