I have the following function:
public SObject PopulateSObjectFieldsForJSON(JSONParser parser)
{
if (sobjectType == 'Queue_BH__c') {
Queue_BH__c qbh = (Queue_BH__c)parser.readValueAs(Queue_BH__c.class);
return qbh;
} else if (sobjectType == 'Time_Zone__c') {
Time_Zone__c tz = (Time_Zone__c)parser.readValueAs(Time_Zone__c.class);
return tz;
}
This function receives JSONParse and returns an object with the fields from the JSON. how can i make it generic so i dont have to handle any object separately like in the above?