xpt*_*xpt 6 json filtering filter jmespath
JMESPath 是 Azure 使用的 JSON 查询语言。
使用http://jmespath.org/给出的自己的示例
{
"locations": [
{"name": "Seattle", "state": "WA"},
{"name": "New York", "state": "NY"},
{"name": "Bellevue", "state": "WA"},
{"name": "Olympia", "state": "WA"}
]
}
Run Code Online (Sandbox Code Playgroud)
如何列出名称中包含字母"l"或字符串的所有位置"le"?谢谢。
myr*_*rdd 10
按字符过滤和按字符串过滤的工作原理相同。
"l"locations[?name.contains(@, `l`)]
Run Code Online (Sandbox Code Playgroud)
结果:
[
{
"name": "Seattle",
"state": "WA"
},
{
"name": "Bellevue",
"state": "WA"
},
{
"name": "Olympia",
"state": "WA"
}
]
Run Code Online (Sandbox Code Playgroud)
"le"locations[?name.contains(@, `le`)]
Run Code Online (Sandbox Code Playgroud)
结果:
[
{
"name": "Seattle",
"state": "WA"
},
{
"name": "Bellevue",
"state": "WA"
}
]
Run Code Online (Sandbox Code Playgroud)
"ue"的位置"ia"locations[?name.contains(@, `ue`) || name.contains(@, `ia`)]
Run Code Online (Sandbox Code Playgroud)
结果:
[
{
"name": "Bellevue",
"state": "WA"
},
{
"name": "Olympia",
"state": "WA"
}
]
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4177 次 |
| 最近记录: |