Say that I have the following Java class
public class ResponseObj
{
private String a;
private String b;
//constructors, getters, and setters
}
Next I do a REST call to an API
ResponseEntity<ResponseObj> response = restTemplate.exchange("http://api.com/employee/24",
HttpMethod.GET, httpEntity, ResponseObj.class);
and the JSON response from the API is as follows
{
"a" : "data1",
"c" : "data2",
"d" : { "prop" : "data3"},
"e" : ["data4","data5"]
}
Will the code produce an error since the JSON response structure is different than ResponseObj? Or will it be fine but ResponseObj won't have properties of "c", "d", and "e" from the JSON response, and property "b" in ResponseObj will have a value of null?