I have the following where the result format of the callout is the following:
[
{
"uid": "72852a55-5be3-496c-904c-fc3fd261f0a4",
"name": "Responseev Agency"
},
{
"uid": "66852a55-5483-496c-904c-fc3fbf48f0a4",
"name": "Haiti Agency"
}
]
I am doing a callout as follows:
HttpResponse response = http.send(request);
if (response.getStatusCode() == 200) {
List<Object> results = (List<Object>) JSON.deserializeUntyped(response.getBody());
system.debug('results '+results);
for (Object agency: results) {
System.debug('(Map<String, Object>)agency'+(Map<String, Object>)agency);
System.debug('agency'+agency);
}
}
system.debug('results '+results);
06:06:10:374 USER_DEBUG [16]|DEBUG|results ({name=AAA, uid=0000-0000-0000-0000})
System.debug('(Map<String, Object>)agency'+(Map<String, Object>)agency);
(Map<String, Object>)agency{name=AAA, uid=0000-0000-0000-0000}
System.debug('agency'+agency);
agency{name=AAA, uid=0000-0000-0000-0000}
Shouldnt I be able to get the uid as the folowing?
System.debug('agency'+agency.get('uid'));
I get the error: Method does not exist or incorrect signature: void get(String) from the type Object