I would like to convert a json with some needed values to a java object but it returns only null values for the properties.
@Getter
@Setter
@AllArgsConstructor
public class Clerk implements Serializable {
@SerializedName(value="cr942_name")
private String name;
@SerializedName(value="cr942_customernumber")
private String customerNumber;
}
private Clerk getClerkByCustomerNumber(String customerNumber) throws IOException {
Gson gson = new Gson();
return gson.fromJson(getStringBodyFromResponse
("cr942_clerk_customers?$filter=cr942_customernumber eq " + "'" + customerNumber + "'"), Clerk.class); //-> Gives Object with null properties
}
Is it because the json has more than just cr942_name and cr942_customername properties thus it cant convert correctly? If yes how do I filter the unneeded Json values so i can convert correctly.