我有一个生成的文件(来自amazon CLI)并希望提取一些属性。通常这对于JQ来说很简单,但是JSON文件没有命名的顶级属性。使用JQ提取没有命名属性的嵌套json文件的对象
[
[
{
"State": "running",
"Type": "c4.xlarge",
"ID": "i-somehere",
"Env": [
"prd"
],
"Name": [
"some url here"
]
}
],
[
{
"State": "stopped",
"Type": "c4.xlarge",
"ID": "i-somehere",
"Env": [
"prd"
],
"Name": [
"some url here"
]
}
],
[
{
"State": "running",
"Type": "c4.2xlarge",
"ID": "i-somehere",
"Env": [
"prd"
],
"Name": [
"some url here"
]
}
]
]
.....我想提取状态,Env和名称....这应该是简单的JQ。“[]。国家” ......然而,国家嵌套在一个对象这是没有命名的。我怎样才能用JQ提取?
三江源。无论节点在层次结构中何处,这都很好用。 – user1351155