I have this class:
public static class Person {
public Person(){
}
public String get_id() {
return _id;
}
public int getIndex() {
return index;
}
public String getGuid() {
return guid;
}
public boolean isActive() {
return isActive;
}
public String getBalance() {
return balance;
}
public String getPicture() {
return picture;
}
public int getAge() {
return age;
}
public String getEyeColor() {
return eyeColor;
}
public String getName() {
return name;
}
public String getGender() {
return gender;
}
public String getCompany() {
return company;
}
public String getEmail() {
return email;
}
public String getPhone() {
return phone;
}
public String getAddress() {
return address;
}
public String getAbout() {
return about;
}
public String getRegistered() {
return registered;
}
public double getLatitude() {
return latitude;
}
public double getLongitude() {
return longitude;
}
public List<String> getTags() {
return tags;
}
public List<App.Friend> getFriends() {
return friends;
}
public String getGreeting() {
return greeting;
}
public String getFavoriteFruit() {
return favoriteFruit;
}
private boolean isActive;
private String _id;
private int index;
private String guid;
private String balance;
private String picture;
private int age;
private String eyeColor;
private String name;
private String gender;
private String company;
private String email;
private String phone;
private String address;
private String about;
private String registered;
private double latitude;
private double longitude;
private List<String> tags;
private List<App.Friend> friends;
private String greeting;
private String favoriteFruit;
@Override
public String toString() {
return "Person{" +
"_id='" + _id + '\'' +
", index=" + index +
", guid='" + guid + '\'' +
", isActive=" + isActive +
", balance='" + balance + '\'' +
", picture='" + picture + '\'' +
", age=" + age +
", eyeColor='" + eyeColor + '\'' +
", name='" + name + '\'' +
", gender='" + gender + '\'' +
", company='" + company + '\'' +
", email='" + email + '\'' +
", phone='" + phone + '\'' +
", address='" + address + '\'' +
", about='" + about + '\'' +
", registered='" + registered + '\'' +
", latitude=" + latitude +
", longitude=" + longitude +
", tags=" + tags +
", friends=" + friends +
", greeting='" + greeting + '\'' +
", favoriteFruit='" + favoriteFruit + '\'' +
'}';
}
}
I'm trying to read a JSON that contains an array of objects using Jackson ObjectMapper, everything works fine but when it has to read the field "isActive" it throws the exeption "com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "isActive" (class com.jcg.maven.App$Person), not marked as ignorable (21 known properties: "gender", "registered", "guid", "name", "latitude", "about", "phone", "longitude", "index", "address", "friends", "favoriteFruit", "tags", "_id", "balance", "company", "picture", "age", "eyeColor", "greeting", "email"])
at [Source: generated.json; line: 6, column: 22] (through reference chain: java.util.ArrayList[0]->com.jcg.maven.Person["isActive"])
I don't want to make it ignorable as I would lost its value, also the field in my JSON file is written this way:
some fields
"isActive": false,
other fields
so I excluded the possibility of a malformed json file