如何在嵌套 json 中使用 jq 查找和替换值
How to find and replace a value with jq in a nested json
如何在嵌套的 json.
中使用 jq 查找和替换值
{
"layout": {
"menu-layout": {
"type": "section",
"title": "Layout and content",
"keys": [
"show-category-icons",
"favbox-show",
"favbox-min-height",
"show-places",
]
},
"menu-behave": {
"type": "section",
"keys": [
"enable-autoscroll",
"search-filesystem"
]
}
},
"favbox-min-height": {
"type": "spinbutton",
"default": 300,
}
}
例如,在上面的这个文件中 teste.json:
我想在项目 "favbox-min-height" 中替换,在键中:值
"default": 300
为了
"default": 400
我做不到,有人可以帮我做吗?
.["favbox-min-height"] |= (.default = 400)
如何在嵌套的 json.
中使用 jq 查找和替换值{
"layout": {
"menu-layout": {
"type": "section",
"title": "Layout and content",
"keys": [
"show-category-icons",
"favbox-show",
"favbox-min-height",
"show-places",
]
},
"menu-behave": {
"type": "section",
"keys": [
"enable-autoscroll",
"search-filesystem"
]
}
},
"favbox-min-height": {
"type": "spinbutton",
"default": 300,
}
}
例如,在上面的这个文件中 teste.json: 我想在项目 "favbox-min-height" 中替换,在键中:值 "default": 300 为了 "default": 400
我做不到,有人可以帮我做吗?
.["favbox-min-height"] |= (.default = 400)