[英]Cannot resolve method 'read' in 'JsonPath'
I currently have a gradle project where I have a line implementation "com.jayway.jsonpath:json-path:2.4.0"
in my build.gradle file.我目前有一个 gradle 项目,在我的 build.gradle 文件中有一行
implementation "com.jayway.jsonpath:json-path:2.4.0"
。 In my code, I have an import statement import org.springframework.data.web.JsonPath;
在我的代码中,我有一个导入语句
import org.springframework.data.web.JsonPath;
, but when I actually use the JsonPath eg obj.put("key", JsonPath.read(jsonStr, "key1.key2.key3.key4"));
,但是当我实际使用 JsonPath 时,例如
obj.put("key", JsonPath.read(jsonStr, "key1.key2.key3.key4"));
, the read method appears as red in my IDE saying that it "Cannot resolve method 'read' in 'JsonPath'". ,读取方法在我的 IDE 中显示为红色,说它“无法解析 'JsonPath' 中的方法'读取'”。 I have tried refreshing gradle dependencies and closing/opening the IDE/window but nothing works - any thoughts?
我尝试刷新 gradle 依赖项并关闭/打开 IDE/窗口,但没有任何效果 - 有什么想法吗?
remove this删除这个
import org.springframework.data.web.JsonPath;
use this用这个
import com.jayway.jsonpath.JsonPath;
Read this documentation to know more about available methods.阅读此文档以了解有关可用方法的更多信息。
Hope this helps.希望这可以帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.