[SalesForce] Getting undefined value in JS variable in lightning component

I have a apex class which is having one method with returntype wrapper class. i am binding the return type in helper in a response attribute (type is object). I want to fetch two variables i.e. id,status from response.
Currently I am getting undefined error in output.

Reponse attribute in cmp:

<aura:attribute name="response" type="object"/>

Helper.js:

({
getStatusHelper : function(component, event,helper) {

    var jobID = event.getParam("Pass_Result");
    component.set("v.jobId", jobID);
    var action = component.get("c.getCalloutResponseStatus");
    
    action.setParams({"jobId": jobID});
    action.setCallback(this, function(response) {
        var state = response.getState();
        if (component.isValid() && state === "SUCCESS") {
           
           component.set("v.response", response.getReturnValue());
            **var getStatus = component.get("v.response").status; //GETTING UNDEFINED ERROR
            var getJobId = component.get("v.response").id; //GETTING UNDEFINED ERROR**
            
        }
        else{
            alert('Failed status call from child!!');
        }

});
      $A.enqueueAction(action);
}

})

can anyone pls help me on this issue.

Best Answer

Make sure your wrapper class is public and has the @AuraEnabled notation in its variables, as well as they are public with get;set; example:

public class wrapperClass{
    @AuraEnabled public List<contact> lstContact{get;set;}
    @AuraEnabled public Integer contactCount{get;set;}
    @AuraEnabled public String headerMsg {get;set;}
}