Please let me know how to merge 2 json files into a new json file.
I used jq , and used the below command:
jq -s add file1.json file2.json > Output.json
But I am not getting the output in json ascii encode. While pasing I get an error :
Failed to parse template: Error parsing JSON: invalid character 'ÿ' looking for beginning of value
Please let me know how can I output to json file in a windows command prompt.
Since
jqdoesn't require a valid JSON to read in a file, any JSON stream will do, I would suggest you just append the two filescat file1.json >> file2.jsonThat said, I believe you can use
jq -s '.[0] * .[1]' file1 file2to merge two JSON filesSee: How to merge 2 json file using jq?