rest-assured-2.4.1 - java.lang.IllegalStateException: Cannot deserialize object because no JSON deserializer found in classpath

4,520 views
Skip to first unread message

SPK

unread,
Aug 14, 2015, 2:48:56 AM8/14/15
to REST assured
Hi,

I am new to rest-assured and have the following code,

String json = RestAssured.get("/posts").asString();

User user = JsonPath.from(json).getObject("[0]", User.class);

assertThat(user.id, equalTo(1));

When i run the code, i get the following error,
java.lang.IllegalStateException: Cannot deserialize object because no JSON deserializer found in classpath. Please put either Jackson or Gson in the classpath.

But, jackson-core-2.0.2 is already in the classpath. Why am i getting this error, am i missing something?

Regards,

SPK

PS:

The json response has the structure as below,

[ { "userId": 1,

       "id: 1,

        ...

     }

   { "userId": 1,

       "id: 2,

        ...

     }

      ...

]


Johan Haleby

unread,
Aug 14, 2015, 7:12:02 AM8/14/15
to rest-a...@googlegroups.com
Hi,

You probably need jackson-databind in your classpath (com.fasterxml.jackson.core:jackson-databind:<version>)

Regards,
/Johan

--
You received this message because you are subscribed to the Google Groups "REST assured" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rest-assured...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

SPK

unread,
Aug 14, 2015, 8:05:42 AM8/14/15
to REST assured
Hi Johan,

I now have jackson-core-2.6.0 and jackson-databind-2.6.0 in the classpath. The code runs with no issues.
Thanks!

Regards,
SPK
Reply all
Reply to author
Forward
0 new messages