Hi,
I was about to submit an issue saying that Jackson doesn't work with RestAssured. But figured out the cause by double-checking the documentation. :)
Before including any JSON serializer into the class path I had seen the exception:
java.lang.IllegalStateException: Cannot serialize object because no JSON serializer found in classpath. Please put either Jackson or Gson in the classpath.
Then googled by 'Jackson', found and added dependency to 'jackson-core'
dependencies {
testCompile 'io.rest-assured:rest-assured:3.0.1'
testCompile 'com.fasterxml.jackson.core:jackson-core:2.8.6'
}
which apparently wouldn't work. To make it work the dependency should have been
'com.fasterxml.jackson.core:jackson-databind:2.8.6'
I suppose it may save few people some time if the exception text says that RestAssured requires exactly 'Jackson (databind)', not anything else.
This is mentioned in the documentation, but not in the exception.
Thanks in advance!
Thanks for the advise, I've fixed this in master now. The message now reads:
Cannot serialize object because no JSON serializer found in classpath. Please put either Jackson (Databind) or Gson in the classpath.
Hello, I'm having the same exception :Cannot deserialize object because no JSON deserializer found in classpath. Please put either Jackson (Databind) or Gson in the classpath.
How how to add JSON deserializer in classpath ?
And according to your answer : You added dependency to 'jackson-core', how can I find this file?
Thank you in advance .
@GhabriA You need a jackson-databind dependency. Here is the link to the latest version:
https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind/2.9.5
There choose the build tool you use in your project (Maven, Gradle, etc.) and copy it to your build file.
It is helped me too. Thanks!
@vpedash
thank you helped a lot
Most helpful comment
@GhabriA You need a
jackson-databinddependency. Here is the link to the latest version:https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind/2.9.5
There choose the build tool you use in your project (Maven, Gradle, etc.) and copy it to your build file.