无法解析 'JsonPath' 中的方法 'read'
Cannot resolve method 'read' in 'JsonPath'
我目前有一个 gradle 项目,我的 build.gradle 文件中有一行 implementation "com.jayway.jsonpath:json-path:2.4.0"
。在我的代码中,我有一个导入语句 import org.springframework.data.web.JsonPath;
,但是当我实际使用 JsonPath 时,例如obj.put("key", JsonPath.read(jsonStr, "key1.key2.key3.key4"));
,读取方法在我的 IDE 中显示为红色,表示它 "Cannot resolve method 'read' in 'JsonPath'"。我已经尝试刷新 gradle 依赖项和 closing/opening IDE/window 但没有任何效果 - 有什么想法吗?
删除这个
import org.springframework.data.web.JsonPath;
使用这个
import com.jayway.jsonpath.JsonPath;
阅读此 documentation 以了解有关可用方法的更多信息。
希望对您有所帮助。
我目前有一个 gradle 项目,我的 build.gradle 文件中有一行 implementation "com.jayway.jsonpath:json-path:2.4.0"
。在我的代码中,我有一个导入语句 import org.springframework.data.web.JsonPath;
,但是当我实际使用 JsonPath 时,例如obj.put("key", JsonPath.read(jsonStr, "key1.key2.key3.key4"));
,读取方法在我的 IDE 中显示为红色,表示它 "Cannot resolve method 'read' in 'JsonPath'"。我已经尝试刷新 gradle 依赖项和 closing/opening IDE/window 但没有任何效果 - 有什么想法吗?
删除这个
import org.springframework.data.web.JsonPath;
使用这个
import com.jayway.jsonpath.JsonPath;
阅读此 documentation 以了解有关可用方法的更多信息。
希望对您有所帮助。