kaido
kaido

Reputation: 351

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. In my code, I have an import statement import org.springframework.data.web.JsonPath;, but when I actually use the JsonPath e.g. 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'". I have tried refreshing gradle dependencies and closing/opening the IDE/window but nothing works - any thoughts?

Upvotes: 0

Views: 1689

Answers (1)

jose praveen
jose praveen

Reputation: 1316

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.

Upvotes: 1

Related Questions