Im trying to get the participants data from API response..

                //Level 1
                Map<String, Object> MapLv1 = (Map<String, Object>) JSON.deserializeUntyped(parser);
                system.debug('MapLv1 Conversation Summary ==>'+MapLv1);

                List<Object> arrayConversationSummary = new list <Object>();
                for (Object o : (List<Object>)Maplv1.get('participants')){

As you can see, i tried to get the participants array data and store it inside list of object..

this is the response example :

"id": "3a8c8cce-1630-4b97-addf-ebffd22360ed",
"startTime": "2018-11-05T10:39:29.517Z",
"endTime": "2018-11-05T10:45:58.398Z",
"address": "tel:+0000",
"participants": [
        "id": "3fe49839-1297-464c-bab5-2b914f9e0257",
        "startTime": "2018-11-05T10:39:29.517Z",
        "endTime": "2018-11-05T10:44:57.877Z",
        "connectedTime": "2018-11-05T10:39:29.546Z",
        "name": "Mobile",
        "queueId": "f7866f57-3522-487e-9a62-7889cd68f782",
        "queueName": "Test Queue",
        "purpose": "customer",
        "participantType": "External",
        "address": "tel:0000",
        "ani": "tel:0000",
        "aniName": "Mobile",
        "dnis": "tel:+0000",
        "wrapupRequired": false,
        "attributes": {
            "SF_WorkSpace": "https://cs5.salesforce.com/console#https%3A%2F%2Fcs5.salesforce.com%2F003O000001COyPi%3Fkey%3D081932903944|%2Fapex%2FPolicyInfoPage%3FparentId%3D1159%26contactID%3D003O000001COyPi%26sessionID%3D003O000001COyPi-005900000052HdyAAE-20181105-05e5d7f02c24c2ee31622061bca94bd4%26policyNo%3D112-01-01%26entity%3DAFI%26policyApp%30000D%26agentS00ervicingCode%3D%26agentProducingCode%3D|%2Fapex%2FClaimInfoPage%3FparentId%3D1159%26contactID%3D003O000001COyPi%26sessionID%3D003O000001COyPi-005900000052HdyAAE-20181105-05e5d7f02c24c2ee31622061bca94bd4%26policyNo%3D112-01-01%26entity%3DAFI%26policyApp000%3D%26agentServicingCode%3D%26agentProducingCode%3D|%2Fapex%2FRHSInfoPage%3FparentId%3D1159%26contactID%3D003O000001COyPi%26sessionID%3D003O000001COyPi-005900000052HdyAAE-20181105-05e5d7f02c24c2ee31622061bca94bd4%26policyNo%3D112-01-01%26entity%3DAFI%26policyApp%3D%26agentServicingCode%3D%26agentProducingCode%3D|%2Fapex%2FCHSInfoPage%3FparentId%3D1159%26contactID%3D003O000001COyPi%26sessionID%3D003O000001COyPi-005900000052HdyAAE-20181105-05e5d7f02c24c2ee31622061bca94bd4%26policyNo%3D112-01-01%26entity%3DAFI%26policyApp%3D%26agentServicingCode%3D%26agentProducingCode%3D|%2Fapex%2FInquiryInfoPage%3FparentId%3D1159%26contactID%3D003O000001COyPi%26sessionID%3D003O000001COyPi-005900000052HdyAAE-20181105-05e5d7f02c24c2ee31622061bca94bd4%26policyNo%3D112-01-01%26entity%3DAFI%26policyApp%3D%26agentServicingCode%3D%26agentProducingCode%3D",
            "SF_WorkSpaceAssociations": "{\"interactionId\":\"0000-1630-0000-addf-0000000\",\"Contacts\":{\"00000\":{\"text\":\"PureCloud 0000- Contact\",\"id\":\"00000\",\"reason\":\"Workspace Transfer\",\"select\":true}},\"Relates\":{}}",
            "CWC_allowACD": "true"
        "calls": [
                "state": "terminated",
                "id": "c339db69-12ac-4cad-9f71-6490c1778b46",
                "direction": "inbound",
                "recording": false,
                "recordingState": "none",
                "muted": false,
                "confined": false,
                "held": false,
                "segments": [
                        "startTime": "2018-11-05T10:39:29.520Z",
                        "endTime": "2018-11-05T10:39:29.546Z",
                        "type": "System",
                        "howEnded": "Interact"
                        "startTime": "2018-11-05T10:39:29.546Z",
                        "endTime": "2018-11-05T10:44:57.877Z",
                        "type": "Interact",
                        "howEnded": "Disconnect",
                        "disconnectType": "endpoint"
                "disconnectType": "endpoint",
                "connectedTime": "2018-11-05T10:39:29.546Z",
                "disconnectedTime": "2018-11-05T10:44:57.877Z",
                "disconnectReasons": [],
                "provider": "Edge",
                "self": {
                    "name": "Mobile",
                    "nameRaw": "",
                    "addressNormalized": "tel:000000",
                    "addressRaw": "sip:00000@",
                    "addressDisplayable": "unavailable"
                "other": {
                    "name": "Jakarta, Indonesia",
                    "nameRaw": "",
                    "addressNormalized": "tel:+00000",
                    "addressRaw": "sip:00000@000-000:5060",
                    "addressDisplayable": "unavailable"

but when I check the debug, the participants data start from 'address' not from 'id', and the parsing result only get the address, ani, and aniName from the JSON response.. there`s no Id..

enter image description here

when I put the response to Map, the Id disappeared enter image description here


JSON.deserializeUntyped returns an object where the keys are in ascending alphabetical order. ID is going to appear far to the right of where the log is cut off in your screenshot, but it is there. You can see the ID using something like this:

for(Object o : (List<Object>)Maplv1.get('participants')){
    Map<String, Object> keyMap = (Map<String, Object>)o;
    system.debug('participant id: '+(String)keyMap.get('id'));
    // ... //
  • @AriefGunawanTjiptorahardja You should learn how to use checkpoints instead of debug statements for larger objects. Debug statements are not useful for objects of this size.
    – sfdcfox
    Nov 6 '18 at 3:57
  • @sfdcfox do checkpoints in dev console work now? I have set them for the past year but nothing is ever output when ran. Might have to try it again.
    – Eric
    Nov 6 '18 at 7:45
  • @Eric They've always worked.... but you have to set your debug level to FINER. I use checkpoints religiously for about as long as they've been around.
    – sfdcfox
    Nov 6 '18 at 7:50
  • @sfdcfox thanks. Still does not work for me in dev console. I set them but nothing appears when the code is ran. No worries, I use them all the time in the IDE just can’t in dev console. Had a case a year ago but got the old dev support closure lol. Thanks.
    – Eric
    Nov 6 '18 at 14:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.