连接 JSON 文件
我想将所有 json 文件连接到特定文件夹中。
我安装了 jq 工具并尝试了不同的方法,但到目前为止没有成功。
感谢您的帮助!
例子 : 1.json
[{
"id": "1",
"name": "Product 1"
},{
"id": "2",
"name": "Product 2"
},{
"id": "3",
"name": "Product 3"
}]
2.json
[{
"id": "10",
"name": "Product 10"
},{
"id": "11",
"name": "Product 11"
},{
"id": "12",
"name": "Product 12"
}]
输出.json
[{
"id": "1",
"name": "Product 1"
},{
"id": "2",
"name": "Product 2"
},{
"id": "3",
"name": "Product 3"
},{
"id": "10",
"name": "Product 10"
},{
"id": "11",
"name": "Product 11"
},{
"id": "12",
"name": "Product 12"
}]
I would like to concatenate all the json files in a specific folder.
I installed jq tools and tried different things but no success so far.
Thanks for your help!
Example :
1.json
[{
"id": "1",
"name": "Product 1"
},{
"id": "2",
"name": "Product 2"
},{
"id": "3",
"name": "Product 3"
}]
2.json
[{
"id": "10",
"name": "Product 10"
},{
"id": "11",
"name": "Product 11"
},{
"id": "12",
"name": "Product 12"
}]
output.json
[{
"id": "1",
"name": "Product 1"
},{
"id": "2",
"name": "Product 2"
},{
"id": "3",
"name": "Product 3"
},{
"id": "10",
"name": "Product 10"
},{
"id": "11",
"name": "Product 11"
},{
"id": "12",
"name": "Product 12"
}]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通过使用
inputs
读取这两个文件(如果您还添加--null-input
(或-n
)选项,效果最佳):Read in both files through using
inputs
(which works best if you also add the--null-input
(or-n
) option):