带有过滤器的 Json Path 逻辑 NOT 运算符不起作用

问题描述

我有 JSON 数据,想在 JSONPath 中使用逻辑 not 运算符,但是,我想动态使用它,因为我的输入字符串由许多过滤器组成,我将这些过滤器转换为 JSONPath 查询

v1/movie?filter=not Metadata.sample eq "NETFLIX" 这样我就可以使用我的 APY。这应该使用 JSONPath 的 Filter 对象转换为 [?(!(@['Metadata']['PLM-CODE'] == 'NETFLIX'))]

现在下面这个完美运行

JsonPath.using(configuration).parse(jsonString).read("$.data[?(!(@['Metadata']['PLM-CODE'] == 'NETFLIX'))]",typeRef);

但是我在使用下面的代码时不能直接添加!

String stringFilter = rightPred.toString();
String notFilterString = "[?(!" + stringFilter.substring(2,stringFilter.length()-1) + ")]";
return Filter.parse(notFilterString);

但解析正在将其转换为 [?(@['Metadata']['PLM-CODE'] == 'NETFLIX' ! null)]

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)