I have multiple json files which just want to merge particular object from them and then save it into new json file: for example:
one.json
two.json
...
and each json file is like this:
one.json
{
"passed": 1,
"fixtures": [
{
"name": "Getting Started one",
"path": "testOne.ts"
}
]
}
two.json
{
"passed": 1,
"fixtures": [
{
"name": "Getting Started two",
"path": "testTwo.ts"
}
]
}
so my final json file should be like this:
final.json
{
"passed": 2,
"fixtures": [{
"name": "Getting Started one",
"path": "testOne.ts"
},
{
"name": "Getting Started two",
"path": "testTwo.ts"
}
]
}
do you have an idea what is the simple way to merge like this.
node: json files is not just two but many so it is good to find every file which has a extension of json. it is good to do this in shell script or node.js.
thanks.