Reputation: 463
This example works fine for me in my eclipse. However, when I have changed the Person class to the following :
package com.thejavageek.jaxrs.model;
public class Person {
private int userSelectList;
public int getUserSetSelectList() {
return userSelectList;
}
public void setUserSetSelectList(int userSelectList) {
this.userSelectList = userSelectList;
}
@Override
public String toString() {
return "Person [userSelectSet=" + userSelectList + "]";
}
}
And I tested by passing the JSON like the following :
Error:
com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "userSelectList" (class com.thejavageek.jaxrs.model.Person), not marked as ignorable (one known property: "userSetSelectList"])
at [Source: io.undertow.servlet.spec.ServletInputStreamImpl@6418702f; line: 1, column: 20] (through reference chain: com.thejavageek.jaxrs.model.Person["userSelectList"])
Why is it that the example form the link I shared above works fine and not this one?
Upvotes: 1
Views: 3162
Reputation: 839
In your json, change "userSelectList" to "userSetSelectList", or change your setter to "setUserSelectList"
Upvotes: 2