I have a sample json as follows:
{
"Id": "someid",
"FirstName": "firstName",
"nestedField": {
"LastName": "lastname"
}
}
If I deserialize it like the following, the "Lastname" is being set even though it is in a nested json object. How can I avoid it?
String request = '{"Id": "0036D00000H24cKQAR","FirstName": "firstName","nestedField": {"LastName": "lastname"}}';
Contact c = (Contact)JSON.deserialize(request, Contact.class);
System.debug(c);