Skip to main content

I’m having problems trying to access Nth element of an array within a bigger JSON object returned by a Zap.

 

For context, I’m using Salesforce API Request (Beta), and calling the composite endpoint, which allows me to call different endpoints within Salesforce subsequently.

 

The Salesforce Zap returns this:
 

 

Where data is a child of “response”, and here’s how it would look as a JSON:

 

{
"response": {
"status": 200,
"headers": {},
"data": {
"compositeResponse": s
{
"body": {
"id": "701PP00000rOSfnYAG",
"success": true,
"errors": ]
},
"httpHeaders": {
"Location": "/services/data/v62.0/sobjects/Campaign/701PP00000rOSfnYAG"
},
"httpStatusCode": 201,
"referenceId": "newCamp"
},
{
"body": {
"attributes": {
"type": "Campaign",
"url": "/services/data/v62.0/sobjects/Campaign/701PP00000rOSfnYAG"
},
"Id": "701PP00000rOSfnYAG",
"IsDeleted": false,
"Name": "Test Webinar"
},
"httpHeaders": {
"Last-Modified": "Mon, 23 Jun 2025 12:57:06 GMT"
},
"httpStatusCode": 200,
"referenceId": "campDetails"
}
]
}
}
}

 

In subsequent Zaps, I am trying to use field mapping to reference specific keys from each element under the array in “compositeResponse”

 

I have tried

 

{{_GEN_1750679257710__response__data__compositeResponsea0]__body__success}}

{{_GEN_1750679257710__response__data__compositeResponse__0__body__success}}

And different variations of that, also tried dot notation, but it’s not picking them up at all.

The only one that works is {{_GEN_1750679257710__response__data__compositeResponse_]body__XXX}}, but it’s not suitable for my case because it apparently aggregates those key-value pairs across all elements in the array in a comma-separated string.

 

I could probably fix this by using a Code step or otherwise, but I want to figure this out as it’s much simpler and straightforward than having to add another step.

 

Thank you for your help!

Hi ​@yIdris 

The raw JSON should be returned from the API request for you to use in a Code step to parse the JSON however you want.

Code help: https://zapier.com/apps/code/integrations#help


Thank you for answer, Troy. But wouldn’t there be a way to simply access an array element from the screens I’ve shared? I am trying to minimize the number of steps I use.


@yIdris 

Help link about custom pill mapping.

Check the examples at the bottom.

 


Hey ​@yIdris, just checking in! How did you get on with the custom pill mapping guide Troy shared? Did help you to get the right field selected, or did you end up using a Code step? 

Keep us posted on how it went, want to make sure you’re all set! 🙂