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 jq
doesn't require a valid JSON to read in a file, any JSON stream will do, I would suggest you just append the two files
cat file1.json >> file2.json
That said, I believe you can use jq -s '.[0] * .[1]' file1 file2
to merge two JSON files