Best answer

How can I get this ID from this nested JSON object?

  • 14 July 2023
  • 2 replies
  • 212 views

Userlevel 2
Badge +1

I have a webhook step that outputs:

{
"value": [
{
"Id": 7555553,
"CustomerRoleId": 8032,
"CustomerId": 442656
},
{
"Id": 7555554,
"CustomerRoleId": 8031,
"CustomerId": 442656
},
{
"Id": 8421389,
"CustomerRoleId": 11975,
"CustomerId": 442656
}
]
}

In my next step I’d like to output the Id associated with CustomerRoleId: 11975.

What would be the best way to go about that? I thought about using a code step but the outputs from the previous step appear to be isolated like this:

And so I can’t seem to act upon the raw output of my webhook step.

What do you think?

icon

Best answer by Troy Tessalone 14 July 2023, 21:11

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

2 replies

Userlevel 7
Badge +14

Hi @ericg 

Good question.

The output form the webhook is an array of objects.

OPTIONS

  1. Use the Looping app to loop thru each array object and follow that with a filter step.
  2. Ask AI
    1. e.g. Zap action: ChatGPT - Extract Structured Data
  3. Use a Code step to isolate the desired value.
    1. You can even ask ChatGPT for help with the Code

 

Userlevel 2
Badge +1

Thanks, Tony. I think Looping is where I’ll go with this one.

I tried to use a code step but got stumped because I couldn’t see a way to set the input as the raw JSON (see second screenshot).