这是我的对象的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,...我已经更新了另一个问题,以更好地反映它的(不是特别可概括的)内容的标题。 –