【发布时间】:2018-02-28 20:25:52
【问题描述】:
我想合并两个包含 JSON 的文件。它们每个都包含一个 JSON 对象数组。
registration.json
[
{ "name": "User1", "registration": "2009-04-18T21:55:40Z" },
{ "name": "User2", "registration": "2010-11-17T15:09:43Z" }
]
useredits.json
[
{ "name": "User1", "editcount": 164 },
{ "name": "User2", "editcount": 150 },
{ "name": "User3", "editcount": 10 }
]
在理想情况下,我希望通过合并操作获得以下结果:
[
{ "name": "User1", "editcount": 164, "registration": "2009-04-18T21:55:40Z" },
{ "name": "User2", "editcount": 150, "registration": "2010-11-17T15:09:43Z" }
]
我找到了https://github.com/stedolan/jq/issues/1247#issuecomment-348817802,但我得到了
jq: error: module not found: jq
【问题讨论】: