function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Adelchi PelizzoAdelchi Pelizzo 

Json parser for InvocableMethod in Flow

I want to show two fields value in a flow screen, but at the moment it gives me null. I use an Invocable method to retrieve a json file, indetify and store only those two values in a subclass containing two invocablevariable. After executing it in dev console, I can print out in system.debug at line 21 and 26 but not at line 33.
 
global class par{
@InvocableMethod(label='Get Map' description='Returns the values of Maps')
    global static List<adel.par.VarWrap> CallMap(){
        List<adel.par.VarWrap> wraps = new List<adel.par.VarWrap>();
        HttpRequest req = new HttpRequest();
        req.setEndpoint('https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&key=AIzaSyBOyIQi54LMykmzSOvCuQ2naVvVQEsEfHw');
        req.setMethod('GET');
        Http http = new Http();
        HTTPResponse res = http.send(req);
        JSONParser parser = JSON.createParser(res.getBody());
        while (parser.nextToken()!= null)
        {  
            adel.par.VarWrap wrap = new adel.par.VarWrap();
            if (parser.getCurrentToken() == JSONToken.FIELD_NAME)
             {
                string fieldName = parser.getText();
                parser.nextToken();
                if(fieldName == 'place_id')
                {
                    wrap.placeRet = parser.getText();
                    system.debug(wrap.placeRet);
                    parser.nextToken();
                }else if(fieldName == 'status')
                    {
                    wrap.statusRet = parser.getText();
                    system.debug(wrap.statusRet);
                    }
                    
            }
            wraps.add(wrap);
        }
        
        system.debug(wraps);
        return wraps;  
    }
    global class VarWrap{
        @InvocableVariable(label='Place')
        public String placeRet;
        @InvocableVariable(label='Status')
        public String statusRet;       
    } 
}
I understand InvocableMethods can return only lists. It would work if the sObject VarWrap contained only one field value.