這是我的對象的JSON數組看起來像JSON對象:遍歷使用JQ
[
{
"Description": "Description 1",
"OutputKey": "OutputKey 1",
"OutputValue": "OutputValue 1"
},
{
"Description": "Description 2",
"OutputKey": "OutputKey 2",
"OutputValue": "OutputValue 2"
},
{
"Description": "Description 3",
"OutputKey": "OutputKey 3",
"OutputValue": "OutputValue 3"
},
{
"Description": "Description 4",
"OutputKey": "OutputKey 4",
"OutputValue": "OutputValue 4"
},
{
"Description": "Description 5",
"OutputKey": "OutputKey 5",
"OutputValue": "OutputValue 5"
},
{
"Description": "Description 6",
"OutputKey": "OutputKey 6",
"OutputValue": "OutputValue 6"
}
]
我如何遍歷這個使用JQ,使我可以在其他命令OutputKey和OutputValue的價值?
@tripleee,作爲其他問題接受答案的作者,我選擇了單獨回答這個問題,因爲重讀這個問題的答案,我不認爲這是在這裏特別有用/適用 - 它花費了太多的時間在「雜草」中,OP做錯了什麼,還沒有提供一個普遍適用的良好實踐。事實上,它假設OP已經知道jq,並且嚴格地關注bash的結束 - 並沒有提供關於如何實際遍歷數組的指導。 –
@tripleee,......老實說,如果有空間把另一個作爲另一個的副本來關閉,我幾乎會試圖關閉這個作爲這個的副本,因爲這裏的答案更可能對其他人有用(並且這裏的問題以一種有利於這種答案的方式被詢問,而沒有需要一系列指導/修正的事先實施)。 –
@tripleee,...我已經更新了另一個問題,以更好地反映它的(不是特別可概括的)內容的標題。 –