将合并后的文件输出到 json 文件
To output the merged file into a json file
请告诉我如何将 2 个 json 文件合并到一个新的 json 文件中。
我使用了 jq ,并使用了以下命令:
jq -s add file1.json file2.json > Output.json
但我没有得到 json ascii 编码的输出。通过时出现错误:
Failed to parse template: Error parsing JSON: invalid character 'ÿ' looking for beginning of value
请告诉我如何在 windows 命令提示符中输出到 json 文件。
因为 jq
不需要有效的 JSON 来读入文件,任何 JSON 流都可以,我建议你只附加两个文件
cat file1.json >> file2.json
也就是说,我相信您可以使用 jq -s '.[0] * .[1]' file1 file2
合并两个 JSON 文件
参见:How to merge 2 json file using jq?
请告诉我如何将 2 个 json 文件合并到一个新的 json 文件中。
我使用了 jq ,并使用了以下命令:
jq -s add file1.json file2.json > Output.json
但我没有得到 json ascii 编码的输出。通过时出现错误:
Failed to parse template: Error parsing JSON: invalid character 'ÿ' looking for beginning of value
请告诉我如何在 windows 命令提示符中输出到 json 文件。
因为 jq
不需要有效的 JSON 来读入文件,任何 JSON 流都可以,我建议你只附加两个文件
cat file1.json >> file2.json
也就是说,我相信您可以使用 jq -s '.[0] * .[1]' file1 file2
合并两个 JSON 文件
参见:How to merge 2 json file using jq?