To merge two json objects, you could use 替换代码0】 命令行工具:
$ jq -s add sample.json another.json
Output:
"name": "sam",
"age": 23,
"designation": "doctor",
"location": "canada"
要更新一个单一的属性。
$ jq '.location="canada"' sample.json
它产生相同的输出。
将"doctor"
加到位置上。
$ jq '.location = "doctor" + .location' input.json
Output:
"name": "sam",
"age": 23,
"designation": "doctor",
"location": "doctorcanada"