簡體   English   中英

JQ 結合 json 與鍵:值

[英]JQ combine json with key:value

我有兩個 Json 文件

第一的:

''' { "KeyID": 7532173, "KeyDetails": "Level 12" } '''

第二:''' { "KeyID": 7532173, "Level": "Access Level" } '''

我想將它們與 KeyId 的鍵:值對相匹配

請告知如何進行

您可以使用if... then... else... end ,或更簡單地說, select

jq -s 'select(.[0].KeyID==.[1].KeyID) | add' file1.json file2.json

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM