How to access nested objects from the result of a http request

Say I have this response:

{
“success”: true,
“data”: {
“pdf”: “Amazon.com”,
“nest”: {“another_key”: 123123}
}
}

how do I access pdf and another_key from the response for use in a form?

Hi, you can use a period to go through the objects, in your example it would be:

data.nest.another_key

Hello, does anyone know how to access the id field in this JSON? This is using the SendGrid API.

I’m trying to return the id in my response. The value that is blurred out is an email address. I’ve tried the following:

  • result.{email}.contact.id
  • result[0].contact.id
  • result.0.contact.id
  • result.0.contact.0.id
  • result.0.{email}.0.contact.0.id

I would have guessed result.email.contact.id

Did you include the response code in your response? For example: 200

Hi Tim, thanks for your reply.

Yes, I have the response code of 200 in my response. I just attempted result.email.contact.id to no avail.

The text I masked in red is my actual email address that I passed into the API call as a parameter.

I don’t know if this helps but if it’s an array of items that can be returned in the response when using the tadabase API and the response looks something like this with a single indent:

{
“items”: [
{
“field_123”: “ABCfdsdfkjh34”,

In the response field you’d use this items.0.field_123 to identify the first record’s field value for field_123

So I think you’d need to establish if it’s a single record you’re expecting or an array for each level (indent) in your response.

What API call are you making to SendGrid I couldn’t see it, are you doing it via the SendGrid pipe or have you made your own API for this call? I’m no expert but happy to try it if you let me know the call…

… although looking again and even though I can’t see the email part at the top I’m wondering if it’s just as simple as:

result.contact.id

Hi Greddie,

Thanks for your reply. I’m using the Get Contacts by Emails API call in the SendGrid pipe.

Sadly, result.contact.id did not appear to work.

The correct syntax would be result.test@test.com.contact.id where test@test.com is the email address that is grayed out.

1 Like