Reputation: 275
I have a JSON Object
{
"firstname": "foo",
"account":
{
"city": "bar"
}
}
which I want serialize in a REST backend:
@POST
public Response create(Employee e)
Classes:
public class Employee {
public String firstname;
private Address address;
}
public class Address {
public String city;
}
Unforutanetly, I always receive a 400
status code. But if I do
public Response create(Object o)
everything works fine. Any ideas?
Upvotes: 2
Views: 1394
Reputation: 279970
Your JSON does not correspond (map) to your POJO types. In the JSON, you have account
, but in your Java type you have address
.
Upvotes: 3