0
我正在嘗試使用jq來提取頂級屬性名稱以及所附的時間戳。JQ:按照正確的順序打印字典鍵名和封裝的屬性
JSON輸入:
[
{
"Something": {
"_metadata": {
"timestamp": "2016-02-18T12:32:50.276Z"
}
}
},
{
"OtherThing": {
"_metadata": {
"timestamp": "2016-03-18T12:32:50.276Z"
}
}
},
{
"ThirdThing": {
"_metadata": {
"timestamp": "2016-04-18T12:32:50.276Z"
}
}
}
]
所需的輸出:
[
{
"Something": "2016-02-18T12:32:50.276Z"
},
{
"OtherThing": "2016-03-18T12:32:50.276Z"
},
{
"ThirdThing": "2016-04-18T12:32:50.276Z"
}
]
試圖jq '.[] | keys'
這給我的只有頂層字典的名稱。
[
"Something"
]
[
"OtherThing"
]
[
"ThirdThing"
]
哪個過濾器可以實現這個功能?
感謝,工程。 – user1877106