Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/368.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Java中以编程方式计算JSONPath表达式_Java_Rest_Jsonpath - Fatal编程技术网

在Java中以编程方式计算JSONPath表达式

在Java中以编程方式计算JSONPath表达式,java,rest,jsonpath,Java,Rest,Jsonpath,我正在构建一个与SOAP后端通信的中间件RestAPI 由于BE需要操作的某些属性,我希望通过JSON路径将它们传递给RESTAPI,Spring Boot微服务应该能够将其转换为后端语言 例如: filter=product[?(@.creationDate>=‘2020-10-01’ && @.name == ‘someName’)] 后端有一些原始过滤机制,但我需要以某种方式转换/提取操作符/左和右节点 我指的是访问它 @.creationDate>='2020-1

我正在构建一个与SOAP后端通信的中间件RestAPI

由于BE需要操作的某些属性,我希望通过JSON路径将它们传递给RESTAPI,Spring Boot微服务应该能够将其转换为后端语言

例如:

filter=product[?(@.creationDate>=‘2020-10-01’ && @.name == ‘someName’)]
后端有一些原始过滤机制,但我需要以某种方式转换/提取操作符/左和右节点

我指的是访问它


@.creationDate>='2020-10-01'

左节点==
@.creationDate

运算符==
>=

右节点==“2020-10-01”

当我使用jayway JSONPath时,我可以使用过滤器编译器并编译该JSONPath表达式

示例编译

import com.jayway.jsonpath.Filter;
import com.jayway.jsonpath.internal.filter.FilterCompiler;
import org.junit.jupiter.api.Test;
public class JsonPathTest {

  @Test
  void testJsonPath(){
    Filter filter= FilterCompiler.compile(" [?(@.status=='Pending' && @.@type=='Document')]");


  }
}

但是我不能以一种可以简单地遍历每个表达式的方式访问编译后的结果

非常感谢您的帮助


BR

这是什么意思?我需要以某种方式翻译/提取操作符/左和右节点。
@.creationDate>='2020-10-01'
左节点==
@.creationDate
操作符==
=
右节点=='2020-10-01'请分享您在原始帖子中添加的编译代码。