JMESPath是用于JSON的查询语言,由Azure使用。
使用http://jmespath.org/提供的自己的示例
{
"locations": [
{"name": "Seattle", "state": "WA"},
{"name": "New York", "state": "NY"},
{"name": "Bellevue", "state": "WA"},
{"name": "Olympia", "state": "WA"}
]
}如何列出其名称包含字母"l"或字符串"le"的所有位置?谢谢。
发布于 2018-06-13 07:51:56
按字符和字符串进行筛选的工作原理相同。
包含"l"的查询位置w/名称
locations[?name.contains(@, `l`)]结果:
[
{
"name": "Seattle",
"state": "WA"
},
{
"name": "Bellevue",
"state": "WA"
},
{
"name": "Olympia",
"state": "WA"
}
]包含"le"的查询位置w/名称
locations[?name.contains(@, `le`)]结果:
[
{
"name": "Seattle",
"state": "WA"
},
{
"name": "Bellevue",
"state": "WA"
}
]查询位置w/包含"ue"或"ia"的名称
locations[?name.contains(@, `ue`) || name.contains(@, `ia`)]结果:
[
{
"name": "Bellevue",
"state": "WA"
},
{
"name": "Olympia",
"state": "WA"
}
]https://stackoverflow.com/questions/50774937
复制相似问题