json - jq simple json object merge/combination
问题描述
a.json
{"a": 1}
b.json
{"b": 1}
Desired outcome
{"a": 1, "b": 1}
jq -s "." a.json b.json
[
{
"a": 1
},
{
"b": 1
}
]
It's wrapped in an array
jq "." a.json b.json
{
"a": 1
}
{
"b": 1
}
That's not even valid json
Is jq the wrong tool here? What is more appropriate?
解决方案
Try:
jq -s 'add' a.json b.json
Result:
{
"a": 1,
"b": 1
}
推荐阅读
- objective-c - 沿着屏幕纹理边缘关闭具有两条边的多边形的算法
- javascript - Node Js,AWS Lambda我如何获得嵌套的异步方法变量
- python - 'dict_values' 如何转换为列表中的整数?
- ssl - 通过 LDAP 实现 Google Cloud Directory Sync 和 AD 链接
- python - 如何在 Windows 10 上为 pyhton3 安装 h264 库
- javascript - 将旧值添加为“幽灵”拇指滑块
- c# - XMl 序列化和反序列化 C# 中的多个派生类
- android - 如何制作主题?
- angularjs - 如何在 AngularJS 中调用 $http.get
- vue.js - “书签”布局的方法