OR operator in JSONPath?

梦想与她 提交于 2019-12-01 16:52:28

From the JSONPath page:

[,] - Union operator in XPath results in a combination of node sets. JSONPath allows alternate names or array indices as a set.

Try

$..log[?(@.severity == 'WARN'), ?(@.severity == 'Error')]

Edit: Looks like there is an open issue for logical AND and OR operators in which they state that the operators are not yet supported by JSONPath.

If you are using Goessner's parser, you can use the || operator within your expression as follows:

$..log[?(@.severity == 'WARN' || @.severity == 'Error')]
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!