仅捕获以下数组中的第二个对象的正确的JMESPath表达式是什么(因为它的topics
数组中有两个以上的对象):
[{
"topics": [
"just one"
]
},
{
"topics": [
"first",
"second",
"third"
]
}
]
我要吐出来
{
"topics": [
"first",
"second",
"third"
]
}
我尝试过[? length(topics) > 2]
,但jp
抱怨:
SyntaxError: Invalid token: tNumber
[? length(topics) > 2]
^
答案 0 :(得分:0)
输入:
[{
"topics": [
"just one"
]
},
{
"topics": [
"first",
"second",
"third"
]
}
]
使用jmesExpression:
[?length(topics)>'2']
获取输出:
[
{
"topics": [
"first",
"second",
"third"
]
}
]